Unreviewed. Mark some more WTF unit tests as slow for GTK and WPE
[WebKit-https.git] / LayoutTests / fast / events / before-input-events-prevent-inline-text-direction.html
1 <!DOCTYPE html>
2 <meta charset="utf8">
3 <html>
4 <head>
5     <script src="../../resources/dump-as-markup.js"></script>
6     <style>
7         #editor {
8             border: 1px blue dashed;
9         }
10     </style>
11     <script>
12         const dumpMarkupOnInput = e => Markup.dump(e.target, `${e.type}, ${e.inputType}, ${e.data} on #${e.target.id}`);
13
14         Markup.description("Verifies that changing the text writing direction fires input events which may be prevented. To manually test, select 'מקור' in the top contenteditable and change the selection direction to 'left to right'; then, select the same word in the prevented contenteditable and change selection direction to 'left to right'. Check that the bottom editable area's contents did not change.");
15         Markup.noAutoDump();
16
17         addEventListener("load", () => {
18             const notPrevented = document.querySelector("#notPrevented");
19             const prevented = document.querySelector("#prevented");
20
21             notPrevented.addEventListener("input", dumpMarkupOnInput);
22             notPrevented.addEventListener("beforeinput", dumpMarkupOnInput);
23             prevented.addEventListener("input", dumpMarkupOnInput);
24             prevented.addEventListener("beforeinput", event => {
25                 dumpMarkupOnInput(event);
26                 event.preventDefault();
27             });
28
29             getSelection().setBaseAndExtent(notPrevented.firstChild, 6, notPrevented.firstChild, 10);
30             if (!window.testRunner)
31                 return;
32             testRunner.execCommand("MakeTextWritingDirectionLeftToRight");
33             getSelection().setBaseAndExtent(notPrevented.lastChild, 11, notPrevented.lastChild, 16);
34             testRunner.execCommand("MakeTextWritingDirectionRightToLeft");
35
36             getSelection().setBaseAndExtent(prevented.firstChild, 6, prevented.firstChild, 10);
37             testRunner.execCommand("MakeTextWritingDirectionLeftToRight");
38             getSelection().setBaseAndExtent(prevented.lastChild, 21, prevented.lastChild, 26);
39             testRunner.execCommand("MakeTextWritingDirectionRightToLeft");
40
41             Markup.notifyDone();
42         });
43     </script>
44 </head>
45 <body>
46     <div contenteditable id="notPrevented">Hello מקור השם עברית world</div>
47     <div contenteditable id="prevented">Hello מקור השם עברית world</div>
48 </body>
49 </html>