OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> |
| 3 <script> |
| 4 onload = function() { |
| 5 if (!window.eventSender || !window.eventSender.gestureLongPress) { |
| 6 debug("gestureLongPress not implemented by this platform."); |
| 7 debug("Manullay long press on every element in the page and check whethe
r Text selection is happening or not"); |
| 8 debug("If Text selection is not happening for readonly or disabled input
/textarea, then it's a failure."); |
| 9 return; |
| 10 } |
| 11 |
| 12 doLongPressOnElement("normalText"); |
| 13 |
| 14 doLongPressOnElement("readOnlyText"); |
| 15 |
| 16 doLongPressOnElement("disabledText"); |
| 17 |
| 18 doLongPressOnElement("readOnlyDisabledText"); |
| 19 |
| 20 doLongPressOnElement("normalTextArea"); |
| 21 |
| 22 doLongPressOnElement("readOnlyTextArea"); |
| 23 |
| 24 doLongPressOnElement("disabledTextArea"); |
| 25 |
| 26 doLongPressOnElement("readOnlyDisabledTextArea"); |
| 27 } |
| 28 |
| 29 function doLongPressOnElement(elementId) { |
| 30 var element = document.getElementById(elementId); |
| 31 var bounds = element.getBoundingClientRect(); |
| 32 var middleX = (bounds.left + bounds.right) / 2; |
| 33 var middleY = (bounds.top + bounds.bottom) / 2; |
| 34 // Touch directly in the center of the element. |
| 35 window.eventSender.gestureLongPress(middleX, middleY); |
| 36 shouldBeEqualToString('window.getSelection().toString()', element.value); |
| 37 } |
| 38 </script> |
| 39 <input id="normalText" type="text" value="NormalInput"> |
| 40 <input id="readOnlyText" type="text" value="ReadonlyInput" readonly> |
| 41 <input id="disabledText" type="text" value="DisabledInput" disabled> |
| 42 <input id="readOnlyDisabledText" size="20" type="text" value="ReadonlyDisabledIn
put"readonly disabled> |
| 43 <textarea id="normalTextArea" cols="31">NormalTextarea</textarea> |
| 44 <textarea id="readOnlyTextArea" cols="31" readonly>ReadonlyTextarea</textarea> |
| 45 <textarea id="disabledTextArea" cols="31" disabled>DisabledTextarea</textarea> |
| 46 <textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>ReadonlyDisa
bledTextarea</textarea> |
| 47 |
OLD | NEW |