[iOS 14] A couple of tests in editing/selection/ios fail after <rdar://problem/60978283>
[WebKit-https.git] / LayoutTests / editing / selection / ios / select-text-in-existing-selection.html
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 <script src="../../../resources/ui-helper.js"></script>
5 <meta name=viewport content="width=device-width, initial-scale=1">
6 <style>
7 body, html {
8     width: 100%;
9     height: 100%;
10     margin: 0;
11 }
12
13 div[contenteditable] {
14     width: 300px;
15     height: 400px;
16     border: 1px solid black;
17     font-size: 64px;
18 }
19 </style>
20 </head>
21 <body>
22 <div contenteditable>The quick brown fox <span id="target">jumped</span> over the lazy dog.</div>
23 <p id="description"></p>
24 <p id="console"></p>
25 <script>
26 jsTestIsAsync = true;
27 let editor = document.querySelector("div[contenteditable]");
28 let target = document.getElementById("target");
29
30 description("This test verifies that the selection can be modified via long press inside an existing selection. To manually test, select all the text in the editable area and long press on a word to change the selection.");
31 document.addEventListener("dragstart", event => event.preventDefault());
32
33 addEventListener("load", async () => {
34     await UIHelper.activateElementAndWaitForInputSession(editor);
35     document.execCommand("SelectAll");
36     await UIHelper.waitForSelectionToAppear();
37     await UIHelper.longPressElement(target);
38     shouldBe("getSelection().getRangeAt(0).commonAncestorContainer", "target.childNodes[0]");
39     finishJSTest();
40 });
41 </script>
42 </body>
43 </html>