From c559e3e30f79843f0096332334c81ee0d93029f8 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Wed, 18 Apr 2018 15:15:49 +0200 Subject: moebius#73: DOM - window.requestIdleCallback - improvements (basic) https://github.com/MoonchildProductions/moebius/pull/73 --- testing/web-platform/meta/MANIFEST.json | 6 ++ .../idle-callbacks/callback-suspended.html | 93 ++++++++++++++++++++++ .../resources/post_name_on_load.html | 7 ++ 3 files changed, 106 insertions(+) create mode 100644 testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html create mode 100644 testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html (limited to 'testing') diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index ca574833b..3c7df67fa 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -38674,6 +38674,12 @@ "url": "/html/webappapis/idle-callbacks/callback-multiple-calls.html" } ], + "html/webappapis/idle-callbacks/callback-suspended.html": [ + { + "path": "html/webappapis/idle-callbacks/callback-suspended.html", + "url": "/html/webappapis/idle-callbacks/callback-suspended.html" + } + ], "html/webappapis/idle-callbacks/callback-timeout.html": [ { "path": "html/webappapis/idle-callbacks/callback-timeout.html", diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html new file mode 100644 index 000000000..6040de922 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html @@ -0,0 +1,93 @@ + + +Dispatching idle callbacks should be able to be suspended and then resumed + + +
+ diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html new file mode 100644 index 000000000..4679a6e6e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html @@ -0,0 +1,7 @@ + + -- cgit v1.2.3 From 823098279935c628f4c684a4d22eb2fe94701d89 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Wed, 18 Apr 2018 15:18:48 +0200 Subject: Bug 1334904 - Add test for when rIC timeouts doesn't need timeout --- .../html/webappapis/idle-callbacks/callback-timeout.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'testing') diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html index 823d5f5db..cc2660a19 100644 --- a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html @@ -25,4 +25,19 @@ } window.requestIdleCallback(t.step_func(f)); }, "requestIdleCallback callback should time out"); + + async_test(function (t) { + assert_false(document.hidden, "document.hidden must exist and be false to run this test properly"); + function g(deadline) { + assert_false(deadline.didTimeout) + t.done(); + } + + function f(deadline) { + assert_false(deadline.didTimeout); + window.requestIdleCallback(t.step_func(g), {timeout:100000}); + } + window.requestIdleCallback(t.step_func(f)); + }, "requestIdleCallback callback should not time out"); + -- cgit v1.2.3 From 718874cf11a06fb2a1d1b51952f24b23c24600ff Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Wed, 18 Apr 2018 15:19:52 +0200 Subject: Bug 1337814 - Add test for cancelling currently executing rIC callback --- .../tests/html/webappapis/idle-callbacks/cancel-invoked.html | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'testing') diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html index 8956b8709..9fb77d65d 100644 --- a/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html +++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html @@ -23,4 +23,10 @@ t.done(); }, 2000); }, "A cancelled callback is never invoked"); + + async_test(function (t) { + var handle = requestIdleCallback(t.step_func_done(function () { + cancelIdleCallback(handle); + })); + }, "Cancelling the currently executing idle callback should be allowed"); -- cgit v1.2.3 From 9957290b5a27555aeebd9c8ce0e6891fee747fee Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Mon, 23 Apr 2018 09:13:00 +0200 Subject: moebius#123: DOM - Events - support createEvent("FocusEvent") https://github.com/MoonchildProductions/moebius/pull/123 --- .../dom/events/EventTarget-dispatchEvent.html.ini | 4 ---- .../meta/dom/nodes/Document-createEvent.html.ini | 24 ---------------------- 2 files changed, 28 deletions(-) (limited to 'testing') diff --git a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini index d62b521c5..0d489b03d 100644 --- a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini +++ b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini @@ -12,10 +12,6 @@ expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 - [If the event's initialized flag is not set, an InvalidStateError must be thrown (FocusEvent).] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - [If the event's initialized flag is not set, an InvalidStateError must be thrown (IDBVersionChangeEvent).] expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 diff --git a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini index 1d92f01ae..a1c822113 100644 --- a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini +++ b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini @@ -76,30 +76,6 @@ expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 - [FocusEvent should be an alias for FocusEvent.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [createEvent('FocusEvent') should be initialized correctly.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [focusevent should be an alias for FocusEvent.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [createEvent('focusevent') should be initialized correctly.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [FOCUSEVENT should be an alias for FocusEvent.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - - [createEvent('FOCUSEVENT') should be initialized correctly.] - expected: FAIL - bug: https://github.com/whatwg/dom/issues/362, 1314303 - [IDBVersionChangeEvent should be an alias for IDBVersionChangeEvent.] expected: FAIL bug: https://github.com/whatwg/dom/issues/362, 1314303 -- cgit v1.2.3 From 0a9acadccafe04aa5bc3335523bb55fe52ca8e50 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Mon, 23 Apr 2018 09:16:50 +0200 Subject: moebius#121: DOM - Selection API - getSelection() should exist on XMLDocument / Selection.type https://github.com/MoonchildProductions/moebius/pull/121 --- testing/web-platform/meta/selection/getSelection.html.ini | 9 --------- 1 file changed, 9 deletions(-) (limited to 'testing') diff --git a/testing/web-platform/meta/selection/getSelection.html.ini b/testing/web-platform/meta/selection/getSelection.html.ini index 4db5721ae..672b83770 100644 --- a/testing/web-platform/meta/selection/getSelection.html.ini +++ b/testing/web-platform/meta/selection/getSelection.html.ini @@ -1,14 +1,5 @@ [getSelection.html] type: testharness - [getSelection() on HTML document with null defaultView must be null] - expected: FAIL - - [getSelection() on XML document with null defaultView must be null] - expected: FAIL - - [getSelection() on HTML document with null defaultView must be null inside an iframe onload] - expected: FAIL - [window.getSelection() instanceof Selection in an iframe immediately after appendChild] expected: FAIL -- cgit v1.2.3 From d9d3b687b7c892b400e781dd5c57897efd7173aa Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Mon, 23 Apr 2018 11:54:06 +0200 Subject: moebius#195: DOM - PointerEvent - improvements https://github.com/MoonchildProductions/moebius/pull/195 --- testing/marionette/element.js | 16 ++++++++++++++-- testing/marionette/error.js | 21 +++++++++++++++++---- .../marionette_harness/tests/unit/test_click.py | 17 +++++++++++++++++ testing/marionette/test_error.js | 20 +++++++++++++++----- 4 files changed, 63 insertions(+), 11 deletions(-) (limited to 'testing') diff --git a/testing/marionette/element.js b/testing/marionette/element.js index 8e66ee6df..9687fb27d 100644 --- a/testing/marionette/element.js +++ b/testing/marionette/element.js @@ -953,6 +953,12 @@ element.getContainer = function (el) { * pointer-interactable, if it is found somewhere in the * |elementsFromPoint| list at |el|'s in-view centre coordinates. * + * Before running the check, we change |el|'s pointerEvents style property + * to "auto", since elements without pointer events enabled do not turn + * up in the paint tree we get from document.elementsFromPoint. This is + * a specialisation that is only relevant when checking if the element is + * in view. + * * @param {Element} el * Element to check if is in view. * @@ -960,8 +966,14 @@ element.getContainer = function (el) { * True if |el| is inside the viewport, or false otherwise. */ element.isInView = function (el) { - let tree = element.getPointerInteractablePaintTree(el); - return tree.includes(el); + let originalPointerEvents = el.style.pointerEvents; + try { + el.style.pointerEvents = "auto"; + const tree = element.getPointerInteractablePaintTree(el); + return tree.includes(el); + } finally { + el.style.pointerEvents = originalPointerEvents; + } }; /** diff --git a/testing/marionette/error.js b/testing/marionette/error.js index 97cc3fb25..c36dace25 100644 --- a/testing/marionette/error.js +++ b/testing/marionette/error.js @@ -260,10 +260,23 @@ class ElementClickInterceptedError extends WebDriverError { if (obscuredEl && coords) { const doc = obscuredEl.ownerDocument; const overlayingEl = doc.elementFromPoint(coords.x, coords.y); - msg = error.pprint`Element ${obscuredEl} is not clickable ` + - `at point (${coords.x},${coords.y}) ` + - error.pprint`because another element ${overlayingEl} ` + - `obscures it`; + + switch (obscuredEl.style.pointerEvents) { + case "none": + msg = error.pprint`Element ${obscuredEl} is not clickable ` + + `at point (${coords.x},${coords.y}) ` + + `because it does not have pointer events enabled, ` + + error.pprint`and element ${overlayingEl} ` + + `would receive the click instead`; + break; + + default: + msg = error.pprint`Element ${obscuredEl} is not clickable ` + + `at point (${coords.x},${coords.y}) ` + + error.pprint`because another element ${overlayingEl} ` + + `obscures it`; + break; + } } super(msg); diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py index d03062e85..06019834a 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py @@ -252,3 +252,20 @@ class TestClick(TestLegacyClick): with self.assertRaises(errors.ElementClickInterceptedException): obscured.click() self.assertFalse(self.marionette.execute_script("return window.clicked", sandbox=None)) + + def test_pointer_events_none(self): + self.marionette.navigate(inline(""" + + + """)) + button = self.marionette.find_element(By.TAG_NAME, "button") + self.assertEqual("none", button.value_of_css_property("pointer-events")) + + with self.assertRaisesRegexp(errors.ElementClickInterceptedException, + "does not have pointer events enabled"): + button.click() + self.assertFalse(self.marionette.execute_script("return window.clicked", sandbox=None)) diff --git a/testing/marionette/test_error.js b/testing/marionette/test_error.js index f27212637..a905f02f0 100644 --- a/testing/marionette/test_error.js +++ b/testing/marionette/test_error.js @@ -209,15 +209,25 @@ add_test(function test_ElementClickInterceptedError() { return otherEl; }, }, + style: { + pointerEvents: "auto", + } }; - let err = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2}); - equal("ElementClickInterceptedError", err.name); + let err1 = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2}); + equal("ElementClickInterceptedError", err1.name); equal("Element is not clickable at point (1,2) " + "because another element obscures it", - err.message); - equal("element click intercepted", err.status); - ok(err instanceof WebDriverError); + err1.message); + equal("element click intercepted", err1.status); + ok(err1 instanceof WebDriverError); + + obscuredEl.style.pointerEvents = "none"; + let err2 = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2}); + equal("Element is not clickable at point (1,2) " + + "because it does not have pointer events enabled, " + + "and element would receive the click instead", + err2.message); run_next_test(); }); -- cgit v1.2.3 From 27e021136b6e58143f95ff3df37b58ed699e8b06 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Tue, 24 Apr 2018 11:47:08 +0200 Subject: moebius#312: DOM - Fix incorrect TypeError: Response body is given with a null body status https://github.com/MoonchildProductions/moebius/issues/312 --- testing/web-platform/tests/fetch/api/response/response-init-002.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'testing') diff --git a/testing/web-platform/tests/fetch/api/response/response-init-002.html b/testing/web-platform/tests/fetch/api/response/response-init-002.html index 0bb2e8d0b..a48af8336 100644 --- a/testing/web-platform/tests/fetch/api/response/response-init-002.html +++ b/testing/web-platform/tests/fetch/api/response/response-init-002.html @@ -65,6 +65,11 @@ }); }, "Testing empty Response Content-Type header"); + test(function() { + var response = new Response(null, {status: 204}); + assert_equals(response.body, null); + }, "Testing null Response body"); + -- cgit v1.2.3