[iOS] Can't select text after dismissing the keyboard when changing focus
[WebKit-https.git] / LayoutTests / editing / selection / ios / select-text-after-changing-focus.html
1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
2 <html>
3 <meta name="viewport" content="width=device-width, initial-scale=1">
4 <head>
5     <script src="../../../resources/basic-gestures.js"></script>
6     <script src="../../../resources/ui-helper.js"></script>
7     <style>
8     body {
9         margin: 0;
10     }
11
12     button, input {
13         width: 100%;
14         height: 100px;
15         font-size: 60px;
16         display: block;
17     }
18
19     #select {
20         font-size: 100px;
21     }
22     </style>
23     <script>
24     if (window.testRunner) {
25         testRunner.dumpAsText();
26         testRunner.waitUntilDone();
27     }
28
29     async function run()
30     {
31         document.addEventListener("selectionchange", () => result.textContent = getSelection().toString());
32         if (!window.testRunner)
33             return;
34
35         await UIHelper.activateAndWaitForInputSessionAt(50, 50);
36         await UIHelper.tapAt(50, 150);
37         await UIHelper.waitForKeyboardToHide();
38         await longPressAtPoint(50, 250);
39         await liftUpAtPoint(50, 250);
40
41         testRunner.notifyDone();
42     }
43     </script>
44 </head>
45 <body onload="run()">
46     <input></input>
47     <button></button>
48     <div id="select">WebKit</div>
49     <pre>The selected text is: "<span id="result"></span>"</pre>
50     <p>This test verifies that it's possible to select text by long pressing after the keyboard is dismissed due to the
51     focused element changing. To manually test, tap the input to show the keyboard then click the button to dismiss the
52     keyboard, and finally try to select the word 'WebKit'.</p>
53 </body>
54 </html>