summaryrefslogtreecommitdiffstats
path: root/widget/tests/test_assign_event_data.html
diff options
context:
space:
mode:
Diffstat (limited to 'widget/tests/test_assign_event_data.html')
-rw-r--r--widget/tests/test_assign_event_data.html46
1 files changed, 43 insertions, 3 deletions
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 @@
<body>
<div id="display">
<input id="input-text">
+ <div contenteditable id="contenteditable"><br></div>
<button id="button">button</button>
<a id="a" href="about:blank">hyper link</a>
<span id="pointer-target">span</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() {