diff options
author | Justin Velluppillai <justin@innocraft.com> | 2021-07-15 05:55:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-15 05:55:17 +0300 |
commit | 96f9c8a5c1c85b87dee250f6c957815616766ad4 (patch) | |
tree | 4fbe79b02131e534cc055d46d07d70fbcce2a04e /tests/javascript/index.php | |
parent | fa66bc580852c2b098ba5ea7f7ba57048f258714 (diff) |
17417 cookie domain (#17744)
* Handle failed promise by silently ignoring it
* rebuilt piwik.js
* Remove unnecessary check for .ready - if serviceWorker exists it should be there anyway
* Set cookie domain even if cookies are disabled; log console errors for issues setting cookies
* rebuilt piwik.js
* Added tests
* Fixed js tests by modifying expected number of asserts
* Fixed JSLint issues
* rebuilt piwik.js
* Don't unset cookie domain at end of test
* Reorder get and set cookie functions to fix jslint issue
* rebuilt piwik.js
* JSLint error from missing ;
Co-authored-by: tsteur <tsteur@users.noreply.github.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r-- | tests/javascript/index.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 098809656f..f589e9cd8a 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -4997,6 +4997,21 @@ if ($mysql) { tracker.forgetCookieConsentGiven(); }); + test("Test API - set cookie domain", function() { + expect(5); + + var tracker = Piwik.getTracker(); + var cookie_domain = tracker.getCookieDomain() + var test_domain = '.' + cookie_domain; + + tracker.setCookieDomain(cookie_domain + '.broken.tld') + equal(tracker.getCookieDomain(), cookie_domain, "can't set a bad cookie domain" ); + + tracker.requireCookieConsent(); + tracker.setCookieDomain(test_domain); + equal(tracker.getCookieDomain(), test_domain, "can set cookie domain after requireCookieConsent disables cookies" ); + }); + test("Test API - optOut (via consent feature)", function () { expect(9); |