Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/javascript/index.php')
-rw-r--r--tests/javascript/index.php32
1 files changed, 25 insertions, 7 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php
index bdc83d5e9c..163baa40f7 100644
--- a/tests/javascript/index.php
+++ b/tests/javascript/index.php
@@ -2104,7 +2104,7 @@ function PiwikTest() {
});
test("API methods", function() {
- expect(79);
+ 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' );
@@ -2179,8 +2184,11 @@ function PiwikTest() {
equal( typeof tracker.setCountPreRendered, 'function', 'setCountPreRendered' );
equal( typeof tracker.trackGoal, 'function', 'trackGoal' );
equal( typeof tracker.trackLink, 'function', 'trackLink' );
+ 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' );
@@ -2515,7 +2523,7 @@ function PiwikTest() {
});
test("Tracker setDomains(), isSiteHostName(), isSiteHostPath(), and getLinkIfShouldBeProcessed()", function() {
- expect(165);
+ expect(168);
var tracker = Piwik.getTracker();
var initialDomains = tracker.getDomains();
@@ -2755,17 +2763,22 @@ 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'));
+ strictEqual(null, tracker.getCookie('34343434343'), 'not existing cookie returns null');
});
test("Tracker CrossDomainLinking()", function() {
@@ -3493,7 +3506,7 @@ if ($mysql) {
});
test("tracking", function() {
- expect(149);
+ expect(152);
// Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL)
var stopEvent = function (evt) {
@@ -3513,7 +3526,9 @@ if ($mysql) {
var tracker = Piwik.getTracker();
tracker.setTrackerUrl("piwik.php");
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('?'));
@@ -3631,6 +3646,8 @@ if ($mysql) {
referrerTimestamp = Math.round(new Date().getTime() / 1000);
tracker.trackPageView();
+ strictEqual(1, tracker.getNumTrackedPageViews(), 'getNumTrackedPageViews, should increase num pageview counter');
+
var idPageview = tracker.getConfigIdPageView();
ok(/([0-9a-zA-Z]){6}/.test(idPageview), 'trackPageview, should generate a random pageview id');
@@ -3638,6 +3655,7 @@ if ($mysql) {
equal(tracker.getCustomDimension(2), "", "custom dimensions should not be cleared after a tracked pageview");
tracker.trackPageView("CustomTitleTest", {dimension2: 'my new value', dimension5: 'another dimension'});
+ strictEqual(2, tracker.getNumTrackedPageViews(), 'getNumTrackedPageViews, should increase num pageview counter');
var idPageviewCustomTitle = tracker.getConfigIdPageView();
ok(idPageviewCustomTitle != idPageview, 'trackPageview, should generate a new random pageview id whenever it is called');