diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-14 02:48:57 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-14 02:48:57 +0300 |
commit | 24b26c6370b6792b6770a8eefcd59bcd9a92f81a (patch) | |
tree | 179f5766b269ff9fb8962bff6a6c3e967e71ff31 /tests/javascript | |
parent | a860a9b7e8dcbb1489d7ed017c31c35c937fb234 (diff) |
Make sure to always trigger a callback in JS trigger when specified (#13855)
* make sure to always trigger a callback in JS trigger when specified
* add changelog entry
* also specify tracker url
* add more properties
Diffstat (limited to 'tests/javascript')
-rw-r--r-- | tests/javascript/index.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index 3dc16c8c2d..65d197544a 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -3592,7 +3592,7 @@ if ($mysql) { }); test("tracking with sendBeacon", function() { - expect(6); + expect(9); var tracker = Piwik.getTracker(); tracker.setTrackerUrl("matomo.php"); @@ -3603,10 +3603,17 @@ if ($mysql) { var shortTitle = 'CustomShortTitleTest'; var longTitle = "CustomLongTitleTest" + (Array(2500).join('f')); tracker.trackPageView(shortTitle); - tracker.trackPageView(longTitle); + var callbackCalled = false; + tracker.trackPageView(longTitle, null, function (event) { + callbackCalled = true; + ok(event.success, 'succeeded'); + ok(event.request.indexOf('action_name=') === 0, 'contains request'); + }); stop(); setTimeout(function() { + ok(callbackCalled, 'called the callback'); + var xhr = makeXhr(); xhr.open("GET", "matomo.php?requests=" + getAlwaysUseSendBeaconToken(), false); xhr.send(null); @@ -3623,7 +3630,7 @@ if ($mysql) { test("tracking", function() { - expect(155); + expect(157); // Prevent Opera and HtmlUnit from performing the default action (i.e., load the href URL) var stopEvent = function (evt) { @@ -3784,7 +3791,10 @@ if ($mysql) { tracker.trackPageView(); var trackLinkCallbackFired = false; - var trackLinkCallback = function () { + var trackLinkCallback = function (event) { + ok(event.success, 'successful event callback'); + ok(event.request.indexOf('link=http') === 0, 'contains request') + trackLinkCallbackFired = true; }; tracker.trackLink("http://example.ca", "link", { "token" : getToken() }, trackLinkCallback); @@ -4968,7 +4978,7 @@ function customAddEventListener(element, eventType, eventHandler, useCapture) { <?php include_once $root . '/core/Filesystem.php'; - $files = \Piwik\Filesystem::globr($root . '/plugins/foo/tests/javascript', 'index.php'); + $files = \Piwik\Filesystem::globr($root . '/plugins/*/tests/javascript', 'index.php'); foreach ($files as $file) { include_once $file; } |