From d8bbc7858622b6d9c278469aab701ca0b609cddf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:35:49 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- widget/tests/test_assign_event_data.html | 46 +++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) (limited to 'widget/tests/test_assign_event_data.html') diff --git a/widget/tests/test_assign_event_data.html b/widget/tests/test_assign_event_data.html index 1da9bb535f..26d214edce 100644 --- a/widget/tests/test_assign_event_data.html +++ b/widget/tests/test_assign_event_data.html @@ -59,6 +59,7 @@
+

hyper link span @@ -352,6 +353,44 @@ const kTests = [ }, todoMismatch: [ ], }, + { description: "InternalLegacyTextEvent (input at key input)", + targetID: "input-text", eventType: "textInput", + dispatchEvent() { + const input = document.getElementById(this.targetID); + input.value = ""; + input.focus(); + synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_B : MAC_VK_ANSI_B, + { shiftKey: true }, "B", "B"); + observeKeyUpOnContent(KeyboardEvent.DOM_VK_B, runNextTest); + return true; + }, + canRun() { + return (kIsMac || kIsWin); + }, + todoMismatch: [], + }, + { description: "InternalLegacyTextEvent (paste)", + targetID: "contenteditable", eventType: "textInput", + async dispatchEvent() { + const editingHost = document.getElementById(this.targetID); + editingHost.innerHTML = "abc"; + editingHost.focus(); + getSelection().selectAllChildren(editingHost); + synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_C : MAC_VK_ANSI_C, + { accelKey: true }, "", "c"); + const waitForInput = new Promise(resolve => { + editingHost.addEventListener("input", resolve, {once: true}); + }); + // In this case, TextEvent.data is stored with a dataTransfer. + synthesizeNativeKey(KEYBOARD_LAYOUT_EN_US, kIsWin ? WIN_VK_V : MAC_VK_ANSI_V, + { accelKey: true }, "", "v"); + await waitForInput; + }, + canRun() { + return (kIsMac || kIsWin); + }, + todoMismatch: [], + }, { description: "WidgetMouseScrollEvent (DOMMouseScroll, vertical)", targetID: "input-text", eventType: "DOMMouseScroll", dispatchEvent() { @@ -615,7 +654,7 @@ const kTests = [ }, ]; -function doTest(aTest) { +async function doTest(aTest) { if (!aTest.canRun()) { SimpleTest.executeSoon(runNextTest); return; @@ -650,7 +689,7 @@ function doTest(aTest) { runNextTest(); } }; - var testWillCallRunNextTest = aTest.dispatchEvent(); + var testWillCallRunNextTest = await aTest.dispatchEvent(); } var gIndex = -1; @@ -695,7 +734,8 @@ function init() { ["mousewheel.with_alt.action", 0], ["mousewheel.with_alt.action.override_x", -1], ["mousewheel.with_meta.action", 0], - ["mousewheel.with_meta.action.override_x", -1]]}, runNextTest); + ["mousewheel.with_meta.action.override_x", -1], + ["dom.events.textevent.enabled", true]]}, runNextTest); } function finish() { -- cgit v1.2.3