diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2017-05-05 13:01:37 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2017-05-05 13:01:37 +0300 |
commit | e1d158f10e46a6f875883f26eea99d5927d024aa (patch) | |
tree | 08d65ca8517535e0a485d76c4327cf94688c4a1b /tests/javascript | |
parent | fe59860c52d939366dd52b7300f787dce21c7733 (diff) |
Expose more cookie methods in tracker
Diffstat (limited to 'tests/javascript')
-rw-r--r-- | tests/javascript/index.php | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index b6575d52e8..2fed61b4a3 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2104,7 +2104,7 @@ function PiwikTest() { }); test("API methods", function() { - expect(80); + expect(87); equal( typeof Piwik.addPlugin, 'function', 'addPlugin' ); equal( typeof Piwik.addPlugin, 'function', 'addTracker' ); @@ -2166,6 +2166,11 @@ function PiwikTest() { equal( typeof tracker.setCookieNamePrefix, 'function', 'setCookieNamePrefix' ); equal( typeof tracker.setCookieDomain, 'function', 'setCookieDomain' ); equal( typeof tracker.setCookiePath, 'function', 'setCookiePath' ); + equal( typeof tracker.setSessionCookie, 'function', 'setSessionCookie' ); + equal( typeof tracker.getCookie, 'function', 'getCookie' ); + equal( typeof tracker.hasCookies, 'function', 'hasCookies' ); + equal( typeof tracker.getCookiePath, 'function', 'getCookiePath' ); + equal( typeof tracker.getSessionCookieTimeout, 'function', 'getSessionCookieTimeout' ); equal( typeof tracker.setVisitorCookieTimeout, 'function', 'setVisitorCookieTimeout' ); equal( typeof tracker.setSessionCookieTimeout, 'function', 'setSessionCookieTimeout' ); equal( typeof tracker.setReferralCookieTimeout, 'function', 'setReferralCookieTimeout' ); @@ -2182,6 +2187,8 @@ function PiwikTest() { equal( typeof tracker.getNumTrackedPageViews, 'function', 'getNumTrackedPageViews' ); equal( typeof tracker.trackPageView, 'function', 'trackPageView' ); equal( typeof tracker.trackRequest, 'function', 'trackRequest' ); + equal( typeof tracker.disableCookies, 'function', 'disableCookies' ); + equal( typeof tracker.deleteCookies, 'function', 'deleteCookies' ); // content equal( typeof tracker.trackAllContentImpressions, 'function', 'trackAllContentImpressions' ); equal( typeof tracker.trackVisibleContentImpressions, 'function', 'trackVisibleContentImpressions' ); @@ -2516,7 +2523,7 @@ function PiwikTest() { }); test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), and getLinkIfShouldBeProcessed()", function() { - expect(165); + expect(167); var tracker = Piwik.getTracker(); var initialDomains = tracker.getDomains(); @@ -2756,17 +2763,21 @@ function PiwikTest() { */ tracker.setCookiePath(null); tracker.setDomains( ['.' + domainAlias + '/tests'] ); - equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically'); + equal(null, tracker.getCookiePath(), 'should not set a cookie path automatically'); tracker.setCookiePath(null); tracker.setDomains( ['.' + domainAlias + '/tests/javascript'] ); - equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically'); + equal(null, tracker.getCookiePath(), 'should not set a cookie path automatically'); tracker.setCookiePath('/path2'); tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.' + domainAlias + '/tests'] ); - equal('/path2', tracker.getConfigCookiePath(), 'should not set a cookie path automatically'); + equal('/path2', tracker.getCookiePath(), 'should not set a cookie path automatically'); tracker.setCookiePath(null); + + strictEqual(true, tracker.hasCookies()); + tracker.setSessionCookie('mytest', 'myvalue'); + equal('myvalue', tracker.getCookie('mytest')); }); test("Tracker CrossDomainLinking()", function() { @@ -3516,7 +3527,7 @@ if ($mysql) { tracker.setSiteId(1); strictEqual(0, tracker.getNumTrackedPageViews(), 'getNumTrackedPageViews, is zero by default'); - + var piwikUrl = location.href; if (piwikUrl.indexOf('?') > 0) { piwikUrl = piwikUrl.substr(0, piwikUrl.indexOf('?')); |