| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| <script src="../../../resources/ui-helper.js"></script> |
| <meta name=viewport content="width=device-width, initial-scale=1"> |
| <style> |
| body, html { |
| width: 100%; |
| height: 100%; |
| margin: 0; |
| } |
| |
| div[contenteditable] { |
| width: 300px; |
| height: 400px; |
| border: 1px solid black; |
| font-size: 64px; |
| } |
| </style> |
| </head> |
| <body> |
| <div contenteditable>The quick brown fox <span id="target">jumped</span> over the lazy dog.</div> |
| <p id="description"></p> |
| <p id="console"></p> |
| <script> |
| jsTestIsAsync = true; |
| let editor = document.querySelector("div[contenteditable]"); |
| let target = document.getElementById("target"); |
| |
| 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."); |
| document.addEventListener("dragstart", event => event.preventDefault()); |
| |
| addEventListener("load", async () => { |
| await UIHelper.activateElementAndWaitForInputSession(editor); |
| document.execCommand("SelectAll"); |
| await UIHelper.waitForSelectionToAppear(); |
| await UIHelper.longPressElement(target); |
| shouldBe("getSelection().getRangeAt(0).commonAncestorContainer", "target.childNodes[0]"); |
| finishJSTest(); |
| }); |
| </script> |
| </body> |
| </html> |