-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor cookiebar JS #100
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #100 +/- ##
==========================================
- Coverage 96.77% 94.97% -1.81%
==========================================
Files 25 12 -13
Lines 714 398 -316
Branches 0 64 +64
==========================================
- Hits 691 378 -313
+ Misses 23 15 -8
- Partials 0 5 +5 ☔ View full report in Codecov by Sentry. |
There are essentially two main flows to the cookie consent bar that logically follow each other with normal use: 1. The user is new and hasn't accepted or declined any cookie groups, or new cookie groups were added that were previously unseen. When the user accepts/declines those cookie groups, the onAccept or onDeclined callback needs to execute for those cookie groups. 2. The user has previously accepted or declined cookies, but the associated (tracking/analytics) scripts are only loaded/activated conditionally (or deactivated with opt-out). The user already consented, so this should also call the onAccept/onDeclined callbacks with the relevant cookie groups. Of course, developers can use the template tags to conditionally emit certain scripts, but that gets in the way of aggressive page/ template caching and is the reason why the original JS solution isn't useful in those situations.
This helps enforce that the Javascript works correctly and *keeps* working correctly.
Tests themselves should not be included in coverage stats, and really only the application itself is relevant.
Can't really do much about the coverage drop because of the tests themselves being excluded from coverage reporting, so I'm merging this as-is and I'll release a beta version. |
Closes #99