From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../interestelement-interface.tentative.html | 164 ++++++++ .../invokeelement-interface.tentative.html | 16 +- .../invokers/invokeevent-interface.tentative.html | 6 +- ...voketarget-button-event-dispatch.tentative.html | 8 +- .../invoketarget-on-dialog-behavior.tentative.html | 455 +++++++++++++++++++++ ...invoketarget-on-popover-behavior.tentative.html | 64 ++- .../semantics/invokers/resources/invoker-utils.js | 8 +- 7 files changed, 685 insertions(+), 36 deletions(-) create mode 100644 testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html create mode 100644 testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html (limited to 'testing/web-platform/tests/html/semantics/invokers') diff --git a/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html new file mode 100644 index 0000000000..dc119de833 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html @@ -0,0 +1,164 @@ + + + + + + + + + + +
+ + diff --git a/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html index b003daf20d..5a2854fe31 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html @@ -53,14 +53,14 @@ test(function () { assert_false(invoker.hasAttribute("invokeaction")); - assert_equals(invoker.invokeAction, "auto"); - }, "invokeAction reflects 'auto' when attribute not present"); + assert_equals(invoker.invokeAction, ""); + }, "invokeAction reflects '' when attribute not present"); test(function () { invoker.setAttribute("invokeaction", ""); assert_equals(invoker.getAttribute("invokeaction"), ""); - assert_equals(invoker.invokeAction, "auto"); - }, "invokeAction reflects 'auto' when attribute empty"); + assert_equals(invoker.invokeAction, ""); + }, "invokeAction reflects '' when attribute empty, setAttribute version"); test(function () { invoker.invokeAction = "fooBarBaz"; @@ -71,8 +71,8 @@ test(function () { invoker.invokeAction = ""; assert_equals(invoker.getAttribute("invokeaction"), ""); - assert_equals(invoker.invokeAction, "auto"); - }, "invokeAction reflects 'auto' when attribute empty 2"); + assert_equals(invoker.invokeAction, ""); + }, "invokeAction reflects '' when attribute empty, IDL version"); test(function () { invoker.invokeAction = [1, 2, 3]; @@ -83,8 +83,8 @@ test(function () { invoker.invokeAction = []; assert_equals(invoker.getAttribute("invokeaction"), ""); - assert_equals(invoker.invokeAction, "auto"); - }, "invokeAction reflects 'auto' when attribute set to []"); + assert_equals(invoker.invokeAction, ""); + }, "invokeAction reflects '' when attribute set to []"); test(function () { invoker.invokeAction = {}; diff --git a/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html index 82910b3d44..382f808071 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html @@ -15,9 +15,9 @@ diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html new file mode 100644 index 0000000000..774d308703 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html index 03eba22285..2bddfa7621 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html @@ -10,7 +10,7 @@
- +
@@ -44,7 +44,7 @@ promise_test(async function (t) { invokee.showPopover(); assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); assert_false(invokee.matches(":popover-open")); }, "invoking (as auto) from within open popover closes"); @@ -55,7 +55,7 @@ once: true, }); assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); assert_true(invokee.matches(":popover-open")); }, "invoking (as auto) open popover with preventDefault does not close"); @@ -93,8 +93,8 @@ promise_test(async function (t) { invokee.showPopover(); - invokerbutton2.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => invokerbutton2.removeAttribute("invokeaction")); + containedinvoker.setAttribute("invokeaction", "togglepopover"); + t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); assert_true(invokee.matches(":popover-open")); await clickOn(invokerbutton); assert_false(invokee.matches(":popover-open")); @@ -102,23 +102,23 @@ promise_test(async function (t) { invokee.showPopover(); - invokerbutton2.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => invokerbutton2.removeAttribute("invokeaction")); + containedinvoker.setAttribute("invokeaction", "togglepopover"); + t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); assert_false(invokee.matches(":popover-open")); }, "invoking (as togglepopover) from within open popover closes"); promise_test(async function (t) { invokee.showPopover(); t.add_cleanup(() => invokee.hidePopover()); - invokerbutton2.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => invokerbutton2.removeAttribute("invokeaction")); + containedinvoker.setAttribute("invokeaction", "togglepopover"); + t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); invokee.addEventListener("invoke", (e) => e.preventDefault(), { once: true, }); assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); assert_true(invokee.matches(":popover-open")); }, "invoking (as togglepopover) open popover with preventDefault does not close"); @@ -175,35 +175,59 @@ }, "invoking (as hidepopover) closed popover is noop"); promise_test(async function (t) { - invokerbutton2.setAttribute("invokeaction", "hidepopover"); - t.add_cleanup(() => invokerbutton2.removeAttribute("invokeaction")); + containedinvoker.setAttribute("invokeaction", "hidepopover"); + t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); invokee.showPopover(); assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); t.add_cleanup(() => invokee.hidePopover()); assert_false(invokee.matches(":popover-open")); }, "invoking (as hidepopover) open popover closes"); promise_test(async function (t) { - invokerbutton2.setAttribute("invokeaction", "hIdEpOpOvEr"); - t.add_cleanup(() => invokerbutton2.removeAttribute("invokeaction")); + containedinvoker.setAttribute("invokeaction", "hIdEpOpOvEr"); + t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); invokee.showPopover(); assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); t.add_cleanup(() => invokee.hidePopover()); assert_false(invokee.matches(":popover-open")); }, "invoking (as hidepopover - case insensitive) open popover closes"); promise_test(async function (t) { - invokerbutton2.setAttribute("invokeaction", "hidepopover"); - t.add_cleanup(() => invokerbutton2.removeAttribute("invokeaction")); + containedinvoker.setAttribute("invokeaction", "hidepopover"); + t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); invokee.showPopover(); t.add_cleanup(() => invokee.hidePopover()); assert_true(invokee.matches(":popover-open")); invokee.addEventListener("invoke", (e) => e.preventDefault(), { once: true, }); - await clickOn(invokerbutton2); + await clickOn(containedinvoker); assert_true(invokee.matches(":popover-open")); }, "invoking (as hidepopover) open popover with preventDefault does not close"); + + // invalid + + ["foo", "togglemodal", "showpicker", "toggle", "open", "close"].forEach(action => { + promise_test(async function (t) { + invokerbutton.setAttribute("invokeaction", action); + t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + assert_false(invokee.matches(":popover-open")); + await clickOn(invokerbutton); + assert_false(invokee.matches(":popover-open")); + }, `invoking (as ${action}) on popover does nothing`); + + promise_test(async function (t) { + invokerbutton.setAttribute("invokeaction", action); + t.add_cleanup(() => { + invokerbutton.removeAttribute("invokeaction") + invokee.hidePopover(); + }); + invokee.showPopover() + assert_true(invokee.matches(":popover-open")); + await clickOn(invokerbutton); + assert_true(invokee.matches(":popover-open")); + }, `invoking (as ${action}) on open popover does nothing`); + }) diff --git a/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js b/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js index 317945502d..8420f24b6f 100644 --- a/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js +++ b/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js @@ -2,9 +2,13 @@ function waitForRender() { return new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve))); } async function clickOn(element) { - const actions = new test_driver.Actions(); await waitForRender(); - await actions.pointerMove(0, 0, {origin: element}) + let rect = element.getBoundingClientRect(); + let actions = new test_driver.Actions(); + // FIXME: Switch to pointerMove(0, 0, {origin: element}) once + // https://github.com/web-platform-tests/wpt/issues/41257 is fixed. + await actions + .pointerMove(Math.round(rect.x + rect.width / 2), Math.round(rect.y + rect.height / 2), {}) .pointerDown({button: actions.ButtonType.LEFT}) .pointerUp({button: actions.ButtonType.LEFT}) .send(); -- cgit v1.2.3