diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2016-09-20 01:14:04 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2016-09-20 01:14:04 +0300 |
commit | 76186e7a5b02e466f5c1165824399caa85c70ccf (patch) | |
tree | 6e917a0148f5b590c851036feb0348a204cfb037 /tests/javascript | |
parent | 39b5cba5c03fe928378bc5c147cda3b260bb23ac (diff) |
expose some DOM methods (#10522)
Diffstat (limited to 'tests/javascript')
-rw-r--r-- | tests/javascript/index.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/javascript/index.php b/tests/javascript/index.php index be4d14f963..143608df4e 100644 --- a/tests/javascript/index.php +++ b/tests/javascript/index.php @@ -612,7 +612,7 @@ function PiwikTest() { }); test("Piwik plugin methods", function() { - expect(19); + expect(26); // TESTS FOR retryMissedPluginCalls @@ -694,6 +694,34 @@ function PiwikTest() { strictEqual(3, calledEvent1, "event, it is possible to remove an event listener and it will not be executed anymore"); strictEqual(2, calledEvent1_1, "event, should still call other event listeners when others were removed"); + /** + * TESTING DOM + **/ + var loaded = false; + var ready = false; + var customEvent = false; + + strictEqual('object', typeof Piwik.DOM, "Piwik.DOM object is defined"); + strictEqual('function', typeof Piwik.DOM.onReady, "DOM.onReady method is defined"); + strictEqual('function', typeof Piwik.DOM.onLoad, "DOM.onLoad method is defined"); + strictEqual('function', typeof Piwik.DOM.addEventListener, "DOM.addEventListener method is defined"); + + Piwik.DOM.onLoad(function () { + loaded = true; + }); + Piwik.DOM.onReady(function () { + ready = true; + }); + + strictEqual(true, ready, "onReady, DOM should be ready"); + strictEqual(true, loaded, "event, DOM should be loaded"); + + Piwik.DOM.addEventListener(_e('click7'), 'myCustomEvent', function () { + customEvent = true; + }); + triggerEvent(_e('click7'), 'myCustomEvent'); + + strictEqual(true, customEvent, "DOM.addEventListener works"); }); test("Query", function() { |