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:
authorThomas Steur <tsteur@users.noreply.github.com>2020-06-12 05:25:35 +0300
committerGitHub <noreply@github.com>2020-06-12 05:25:35 +0300
commitaeaa91c78024e2640822874bd5732af0fff0038e (patch)
tree2749afa562a41668a488350ba2c5c99ffc7bccc1 /tests/javascript
parent59698ee2a889ff321c53d526c4b3b61d9660ab4a (diff)
Rename Piwik -> Matomo in JS tracker where possible (#16052)
* Rename Piwik -> Matomo in JS Tracker * fix tests * rebuilt piwik.js
Diffstat (limited to 'tests/javascript')
-rw-r--r--tests/javascript/content-fixtures/contentUtilities.html2
-rw-r--r--tests/javascript/content-fixtures/findContentNodesTest.html12
-rw-r--r--tests/javascript/index.php42
-rw-r--r--tests/javascript/matomotest.js6
4 files changed, 33 insertions, 29 deletions
diff --git a/tests/javascript/content-fixtures/contentUtilities.html b/tests/javascript/content-fixtures/contentUtilities.html
index 4db210e5ae..e2ab460626 100644
--- a/tests/javascript/content-fixtures/contentUtilities.html
+++ b/tests/javascript/content-fixtures/contentUtilities.html
@@ -9,7 +9,7 @@
<a href="http://www.example.com">Link</a>
</div>
<!-- targetNode in this example is the content block node -->
-<div id="ignoreInteraction4" data-track-content class="piwikContentIgnoreInteraction">
+<div id="ignoreInteraction4" data-track-content class="matomoContentIgnoreInteraction">
<a href="http://www.example.com">Link</a>
</div>
diff --git a/tests/javascript/content-fixtures/findContentNodesTest.html b/tests/javascript/content-fixtures/findContentNodesTest.html
index 94a1fdc99e..78cbd5fc5a 100644
--- a/tests/javascript/content-fixtures/findContentNodesTest.html
+++ b/tests/javascript/content-fixtures/findContentNodesTest.html
@@ -8,8 +8,8 @@
</div>
<!-- used for testing detection of content elements via class -->
<div id="ex4" data-track-content>
- <img src="http://www.example.com/path/xyz.jpg" class="piwikContentPiece" />
- <a href="/anylink" class="piwikContentTarget">Add to shopping cart</a>
+ <img src="http://www.example.com/path/xyz.jpg" class="matomoContentPiece" />
+ <a href="/anylink" class="matomoContentTarget">Add to shopping cart</a>
</div>
<!-- used for testing detection of attribute takes precendency over CSS-->
<div id="ex5" data-track-content>
@@ -20,10 +20,10 @@
</div>
<!-- used for testing always the first matching one will be picked if many have same class -->
<div id="ex6" data-track-content>
- <span src="http://www.example.com/path/xyz.jpg" class="piwikContentPiece">Piece with class1</span>
- <span src="http://www.example.com/path/xyz.jpg" class="piwikContentPiece">Piece with class2</span>
- <a href="/anylink" class="piwikContentTarget">Target with class1</a>
- <a href="/anylink" class="piwikContentTarget">Target with class2</a>
+ <span src="http://www.example.com/path/xyz.jpg" class="matomoContentPiece">Piece with class1</span>
+ <span src="http://www.example.com/path/xyz.jpg" class="matomoContentPiece">Piece with class2</span>
+ <a href="/anylink" class="matomoContentTarget">Target with class1</a>
+ <a href="/anylink" class="matomoContentTarget">Target with class2</a>
</div>
<!-- used for testing always the first matching one will be picked if many have same attribute -->
<div id="ex7" data-track-content>
diff --git a/tests/javascript/index.php b/tests/javascript/index.php
index 0a5978481b..19f0b8187b 100644
--- a/tests/javascript/index.php
+++ b/tests/javascript/index.php
@@ -1302,7 +1302,7 @@ function PiwikTest() {
function assertShouldIgnoreInteraction(id, message) {
var node = content.findTargetNode(_e(id));
strictEqual(content.shouldIgnoreInteraction(node), true, message);
- ok($(node).hasClass(content.CONTENT_IGNOREINTERACTION_CLASS) || undefined !== $(node).attr(content.CONTENT_IGNOREINTERACTION_ATTR), "needs to have either attribute or class");
+ ok($(node).hasClass(content.LEGACY_CONTENT_IGNOREINTERACTION_CLASS) || $(node).hasClass(content.CONTENT_IGNOREINTERACTION_CLASS) || undefined !== $(node).attr(content.CONTENT_IGNOREINTERACTION_ATTR), id + " needs to have either attribute or class");
}
function assertShouldNotIgnoreInteraction(id, message) {
@@ -2047,11 +2047,12 @@ function PiwikTest() {
});
test("Basic requirements", function() {
- expect(3);
+ expect(4);
equal( typeof encodeURIComponent, 'function', 'encodeURIComponent' );
ok( RegExp, "RegExp" );
ok( Piwik, "Piwik" );
+ ok( Matomo, "Matomo" );
});
test("Test API - addPlugin(), getTracker(), getHook(), and hook", function() {
@@ -2796,7 +2797,7 @@ function PiwikTest() {
var isSameCrossDomainDevice = tracker.hook.test._isSameCrossDomainDevice;
var makeCrossDomainDeviceId = tracker.hook.test._makeCrossDomainDeviceId;
var replaceHrefForCrossDomainLink = tracker.hook.test._replaceHrefForCrossDomainLink;
- var isLinkToDifferentDomainButSamePiwikWebsite = tracker.hook.test._isLinkToDifferentDomainButSamePiwikWebsite;
+ var isLinkToDifferentDomainButSameMatomoWebsite = tracker.hook.test._isLinkToDifferentDomainButSameMatomoWebsite;
strictEqual(false, tracker.isCrossDomainLinkingEnabled(), 'function', "isCrossDomainLinkingEnabled is disabled by default" );
@@ -2891,7 +2892,7 @@ function PiwikTest() {
if (url !== null) {
a.setAttribute('href', url);
}
- return isLinkToDifferentDomainButSamePiwikWebsite(a);
+ return isLinkToDifferentDomainButSameMatomoWebsite(a);
}
strictEqual(false, makeIsLinkToDifferentDomainButSamePiwikWebsite(null), 'isLinkToDifferentDomainButSamePiwikWebsite, should not return anything if no href is set');
strictEqual(false, makeIsLinkToDifferentDomainButSamePiwikWebsite(''), 'isLinkToDifferentDomainButSamePiwikWebsite, should not return anything if empty href is set');
@@ -2936,7 +2937,7 @@ function PiwikTest() {
});
test("Tracker getClassesRegExp()", function() {
- expect(3);
+ expect(5);
var tracker = Piwik.getTracker();
@@ -2945,8 +2946,11 @@ function PiwikTest() {
var download = tracker.hook.test._getClassesRegExp([], 'download');
ok( download.test('piwik_download'), 'piwik_download (default)' );
+ ok( download.test('matomo_download'), 'matomo_download (default)' );
+
var outlink = tracker.hook.test._getClassesRegExp([], 'link');
ok( outlink.test('piwik_link'), 'piwik_link (default)' );
+ ok( outlink.test('matomo_link'), 'matomo_link (default)' );
});
@@ -3425,20 +3429,20 @@ function PiwikTest() {
var tracker = Piwik.getTracker();
// test getPiwikUrlForOverlay
- var getPiwikUrlForOverlay = tracker.hook.test._getPiwikUrlForOverlay;
-
- equal( typeof getPiwikUrlForOverlay, 'function', 'getPiwikUrlForOverlay' );
- equal( getPiwikUrlForOverlay('http://www.example.com/js/tracker.php?version=232323'), 'http://www.example.com/', 'with query and js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/tracker.php?version=232323'), 'http://www.example.com/', 'with query and no js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/js/tracker.php'), 'http://www.example.com/', 'no query, custom tracker and js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/tracker.php'), 'http://www.example.com/', 'no query, custom tracker and no js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/js/matomo.php'), 'http://www.example.com/', 'with matomo.php and no js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/matomo.php'), 'http://www.example.com/', 'with matomo.php and no js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/master/js/matomo.php'), 'http://www.example.com/master/', 'installed in custom folder and js folder' );
- equal( getPiwikUrlForOverlay('http://www.example.com/master/matomo.php'), 'http://www.example.com/master/', 'installed in custom folder and no js folder' );
- equal( getPiwikUrlForOverlay('/matomo.php'), toAbsoluteUrl('/'), 'only matomo.php with leading slash' );
- equal( getPiwikUrlForOverlay('matomo.php'), toAbsoluteUrl(''), 'only matomo.php' );
- equal( getPiwikUrlForOverlay('/matomo.php?version=1234'), toAbsoluteUrl('/'), 'only matomo.php with leading slash with query' );
+ var getMatomoUrlForOverlay = tracker.hook.test._getMatomoUrlForOverlay;
+
+ equal( typeof getMatomoUrlForOverlay, 'function', 'getMatomoUrlForOverlay' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/js/tracker.php?version=232323'), 'http://www.example.com/', 'with query and js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/tracker.php?version=232323'), 'http://www.example.com/', 'with query and no js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/js/tracker.php'), 'http://www.example.com/', 'no query, custom tracker and js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/tracker.php'), 'http://www.example.com/', 'no query, custom tracker and no js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/js/matomo.php'), 'http://www.example.com/', 'with matomo.php and no js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/matomo.php'), 'http://www.example.com/', 'with matomo.php and no js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/master/js/matomo.php'), 'http://www.example.com/master/', 'installed in custom folder and js folder' );
+ equal( getMatomoUrlForOverlay('http://www.example.com/master/matomo.php'), 'http://www.example.com/master/', 'installed in custom folder and no js folder' );
+ equal( getMatomoUrlForOverlay('/matomo.php'), toAbsoluteUrl('/'), 'only matomo.php with leading slash' );
+ equal( getMatomoUrlForOverlay('matomo.php'), toAbsoluteUrl(''), 'only matomo.php' );
+ equal( getMatomoUrlForOverlay('/matomo.php?version=1234'), toAbsoluteUrl('/'), 'only matomo.php with leading slash with query' );
});
function generateAnIframeInDocument() {
diff --git a/tests/javascript/matomotest.js b/tests/javascript/matomotest.js
index 3c3b0701f1..763d56bf4c 100644
--- a/tests/javascript/matomotest.js
+++ b/tests/javascript/matomotest.js
@@ -7,7 +7,7 @@
/*global Piwik getToken */
-Piwik.addPlugin('testPlugin', {
+Matomo.addPlugin('testPlugin', {
/*
* called when tracker instantiated
* - function or string to be eval()'d
@@ -42,7 +42,7 @@ Piwik.addPlugin('testPlugin', {
'_makeCrossDomainDeviceId: makeCrossDomainDeviceId,' +
'_isSameCrossDomainDevice: isSameCrossDomainDevice,' +
'_replaceHrefForCrossDomainLink: replaceHrefForCrossDomainLink,' +
- '_isLinkToDifferentDomainButSamePiwikWebsite: isLinkToDifferentDomainButSamePiwikWebsite,' +
+ '_isLinkToDifferentDomainButSameMatomoWebsite: isLinkToDifferentDomainButSameMatomoWebsite,' +
'_arrayChunk : arrayChunk,' +
'_urlFixup : urlFixup,' +
'_domainFixup : domainFixup,' +
@@ -53,7 +53,7 @@ Piwik.addPlugin('testPlugin', {
'_resolveRelativeReference : resolveRelativeReference,' +
'_addEventListener : addEventListener,' +
'_prefixPropertyName : prefixPropertyName,' +
- '_getPiwikUrlForOverlay : getPiwikUrlForOverlay, ' +
+ '_getMatomoUrlForOverlay : getMatomoUrlForOverlay, ' +
'_windowAlias : windowAlias, ' +
'_refreshConsentStatus : refreshConsentStatus, ' +
'_isInsideAnIframe : isInsideAnIframe' +