diff options
author | Matthieu Aubry <matt@piwik.org> | 2016-03-30 06:12:12 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2016-03-30 06:12:12 +0300 |
commit | 7a894b766390595b19746776ed97931c64a96fe5 (patch) | |
tree | f7c0010e96d178fd8dbeb6bf013234cec1c331bf /tests | |
parent | 045ca764dad3d7e52587815b495674617a2d3bd4 (diff) | |
parent | 3ff659d4281637bb752800d32f18cdd0050590b2 (diff) |
Merge pull request #9933 from piwik/remove_magic_setCookiePath
piwik.js: remove the feature of `setDomains` that sets cookie path
Diffstat (limited to 'tests')
-rw-r--r-- | tests/javascript/index.php | 37 | ||||
-rw-r--r-- | tests/javascript/piwiktest.js | 1 |
2 files changed, 5 insertions, 33 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 2e0e48723d..fa8cfc4886 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -2243,8 +2243,8 @@ function PiwikTest() { } }); - test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), findConfigCookiePathToUse() and getLinkIfShouldBeProcessed()", function() { - expect(117); + test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), and getLinkIfShouldBeProcessed()", function() { + expect(105); var tracker = Piwik.getTracker(); var initialDomains = tracker.getDomains(); @@ -2253,12 +2253,10 @@ function PiwikTest() { equal( typeof tracker.hook.test._isSiteHostName, 'function', "isSiteHostName" ); equal( typeof tracker.hook.test._isSiteHostPath, 'function', "isSiteHostPath" ); equal( typeof tracker.hook.test._getLinkIfShouldBeProcessed, 'function', "getLinkIfShouldBeProcessed" ); - equal( typeof tracker.hook.test._findConfigCookiePathToUse, 'function', "findConfigCookiePathToUse" ); var isSiteHostName = tracker.hook.test._isSiteHostName; var isSiteHostPath = tracker.hook.test._isSiteHostPath; var getLinkIfShouldBeProcessed = tracker.hook.test._getLinkIfShouldBeProcessed; - var findConfigCookiePathToUse = tracker.hook.test._findConfigCookiePathToUse; // tracker.setDomain() @@ -2416,45 +2414,20 @@ function PiwikTest() { "type": "link" }, getLinkIfShouldBeProcessed(createLink('http://www.piwik.org/footer')), 'getLinkIfShouldBeProcessed http://www.piwik.org/footer and there is domain piwik.org/foo but it should be outlink as path is different') - - /** - * findConfigCookiePathToUse () - */ - - tracker.setDomains( ['.piwik.org', '.piwik.pro/foo/bar', '.piwik.pro/foo', '.piwik.com/test/foo', 'example.com/foo'] ); - - equal(null, findConfigCookiePathToUse('.piwik.org/test', 'http://piwik.org/test/two'), 'findConfigCookiePathToUse no cookiePath because there is a domain alias given allowing them all'); - equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a match'); - equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo/bar/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically'); - equal('/foo', findConfigCookiePathToUse('.piwik.pro/foo/bar/test', 'http://piwik.pro/foo'), 'findConfigCookiePathToUse should find a less restrictive path automatically, urlPath===domainPath'); - equal('/test/bar/test', findConfigCookiePathToUse('.piwik.com/test/bar/test', 'http://piwik.com/test/bar/test/'), 'findConfigCookiePathToUse should use exactly given path if no less restrictive version is available'); - equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo/test', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically, configAlias === currentUrl'); - equal('/test/foo', findConfigCookiePathToUse('.piwik.com/test/foo', 'http://piwik.com/test/foo/test'), 'findConfigCookiePathToUse should find a less restrictive path automatically'); - equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro/test'), 'findConfigCookiePathToUse should not return a path when user is actually not on that path'); - equal(null, findConfigCookiePathToUse('.piwik.pro/foo', 'http://piwik.pro'), 'findConfigCookiePathToUse when there is no path set we cannot use a configPath'); - /** * Test sets a good cookie path automatically */ tracker.setCookiePath(null); tracker.setDomains( ['.' + domainAlias + '/tests'] ); - equal('/tests', tracker.getConfigCookiePath()), 'should set a cookie path automatically'; + equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically'); tracker.setCookiePath(null); tracker.setDomains( ['.' + domainAlias + '/tests/javascript'] ); - equal('/tests/javascript', tracker.getConfigCookiePath()), 'should set a cookie path automatically, multiple directories'; + equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically'); tracker.setCookiePath(null); tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.' + domainAlias + '/tests'] ); - equal('/tests', tracker.getConfigCookiePath()), 'should find shortest path for possible cookie path'; - - tracker.setCookiePath(null); - tracker.setDomains( ['.' + domainAlias + '/tests/javascript', '.example.com/tests'] ); - equal('/tests/javascript', tracker.getConfigCookiePath()), 'should not find a shorter path when no other domain matches'; - - tracker.setCookiePath(null); - tracker.setDomains( ['.' + domainAlias + '/another/one', '.example.org/tests/javascript', '.example.com/tests'] ); - equal(null, tracker.getConfigCookiePath()), 'should not set a path when no domain and no path matches'; + equal(null, tracker.getConfigCookiePath(), 'should not set a cookie path automatically'); tracker.setCookiePath(null); }); diff --git a/tests/javascript/piwiktest.js b/tests/javascript/piwiktest.js index ff5525c47d..8430f54055 100644 --- a/tests/javascript/piwiktest.js +++ b/tests/javascript/piwiktest.js @@ -27,7 +27,6 @@ Piwik.addPlugin('testPlugin', { '_getCookieName : getCookieName,' + '_setCookie : setCookie,' + '_getLinkIfShouldBeProcessed : getLinkIfShouldBeProcessed,' + - '_findConfigCookiePathToUse : findConfigCookiePathToUse,' + '_encode : encodeWrapper,' + '_decode : decodeWrapper,' + '_urldecode : urldecode,' + |