diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-29 09:07:42 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-29 09:07:42 +0200 |
commit | aff03b0a67c41cf7af5df9c9eef715a8b27a2667 (patch) | |
tree | aa2909ae4718f81c83c8cfb68c1f5a23485b3173 /testing | |
parent | bdb4ff581677ad1cd411b55a68c87534f9a64882 (diff) | |
parent | 11caf6ecb3cb8c84d2355a6c6e9580a290147e92 (diff) | |
download | UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar.gz UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar.lz UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar.xz UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into js_dom_performance-resource-timing_1
Diffstat (limited to 'testing')
8 files changed, 68 insertions, 48 deletions
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 style="pointer-events: none">click me</button> + <script> + window.clicked = false; + let button = document.querySelector("button"); + button.addEventListener("click", () => window.clicked = true); + </script> + """)) + 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 <b> is not clickable at point (1,2) " + "because another element <a> 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 <b> is not clickable at point (1,2) " + + "because it does not have pointer events enabled, " + + "and element <a> would receive the click instead", + err2.message); run_next_test(); }); 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 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 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"); + </script> </body> </html> |