| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <script src="../../../../resources/basic-gestures.js"></script> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| async function runTest() |
| { |
| if (!testRunner.runUIScript) |
| return; |
| |
| var output = ''; |
| var noneditableTargetRect = document.getElementById('noneditableTapPoint').getBoundingClientRect(); |
| |
| var noneditableTapPointX = noneditableTargetRect.x + noneditableTargetRect.width / 2; |
| var noneditableTapPointY = noneditableTargetRect.y + noneditableTargetRect.height / 2; |
| |
| await doubleTapAtPoint(noneditableTapPointX, noneditableTapPointY); |
| if (document.getSelection().type == "None") |
| output += 'PASS: No Selection'; |
| else |
| output += 'FAIL: Has selection even though we should not. Incorrect Selection: ' + document.getSelection().toString(); |
| output += '<br>'; |
| |
| var editableTargetRect = document.getElementById('noneditableTapPoint').getBoundingClientRect(); |
| |
| var editableTapPointX = editableTargetRect.x + editableTargetRect.width / 2; |
| var editableTapPointY = editableTargetRect.y + editableTargetRect.height / 2; |
| |
| await doubleTapAtPoint(noneditableTapPointX, noneditableTapPointY); |
| if (document.getSelection().type == "None") |
| output += 'PASS: Has Selection'; |
| else |
| output += 'FAIL: No selection even though we should have one.'; |
| output += '<br>'; |
| |
| var noneditableElement = document.getElementById('noneditable'); |
| noneditableElement.parentNode.removeChild(noneditableElement); |
| var editableElement =document.getElementById('editable'); |
| editableElement.parentNode.removeChild(editableElement); |
| document.getElementById('target').innerHTML = output; |
| testRunner.notifyDone(); |
| } |
| |
| window.addEventListener('load', runTest, false); |
| </script> |
| <style> |
| #noneditable { |
| height: 200px; |
| width: 300px; |
| background-color: silver; |
| font-family: monospace; |
| font-size: 18px; |
| } |
| #editable { |
| height: 200px; |
| width: 300px; |
| background-color: silver; |
| font-family: monospace; |
| font-size: 18px; |
| } |
| #target { |
| height: 50px; |
| width: 300px; |
| background-color: silver; |
| font-family: monospace; |
| font-size: 18px; |
| } |
| </style> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| </head> |
| <body> |
| |
| <div id="noneditable"> |
| <p>Lorem ipsum dolor sit amet, <span id="noneditableTapPoint">consectetur</span> adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> |
| </div> |
| <div id="editable" contenteditable> |
| <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> |
| </div> |
| <div id="target"> |
| This test requires UIScriptController to run. |
| </div> |
| </body> |
| </html> |