OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 <script> |
| 6 function test() { |
| 7 jsTestAsync = true; |
| 8 if (window.testRunner) |
| 9 testRunner.dumpAsText(); |
| 10 |
| 11 if (!window.eventSender) |
| 12 return; |
| 13 |
| 14 if (!window.eventSender.gestureLongPress) { |
| 15 debug("gestureLongPress not implemented by this platform."); |
| 16 debug("Manullay long press on every element in the page and check whethe
r Paste Popup is appearing or not"); |
| 17 debug("If Paste popup is appearing for readonly or disabled input/textar
ea, then it's a failure."); |
| 18 return; |
| 19 } |
| 20 |
| 21 // Normal Text |
| 22 doLongPressOnElement("normalText"); |
| 23 |
| 24 // ReadOnly Text |
| 25 doLongPressOnElement("readOnlyText"); |
| 26 |
| 27 // Disabled Text |
| 28 doLongPressOnElement("disabledText"); |
| 29 |
| 30 // ReadOnly and Disabled Text |
| 31 doLongPressOnElement("readOnlyDisabledText"); |
| 32 |
| 33 // Normal TextArea |
| 34 doLongPressOnElement("normalTextArea"); |
| 35 |
| 36 // ReadOnly TextArea |
| 37 doLongPressOnElement("readOnlyTextArea"); |
| 38 |
| 39 // Disabled TextArea |
| 40 doLongPressOnElement("disabledTextArea"); |
| 41 |
| 42 // ReadOnly and Disabled TextArea |
| 43 doLongPressOnElement("readOnlyDisabledTextArea"); |
| 44 |
| 45 finishJSTest(); |
| 46 } |
| 47 |
| 48 function doLongPressOnElement(elementId) { |
| 49 var element = document.getElementById(elementId); |
| 50 var bounds = element.getBoundingClientRect(); |
| 51 var middleX = (bounds.left + bounds.right) / 2; |
| 52 var middleY = (bounds.top + bounds.bottom) / 2; |
| 53 // Touch directly in the center of the element. |
| 54 window.eventSender.gestureLongPress(middleX, middleY); |
| 55 var touchNode = document.elementFromPoint(middleX, middleY); |
| 56 shouldBe(touchNode.id, elementId); |
| 57 } |
| 58 </script> |
| 59 </head> |
| 60 <body onload="test();"> |
| 61 <input id="normalText" type="text" value="Normal input"> |
| 62 <input id="readOnlyText" type="text" value="Readonly input" readonly> |
| 63 <input id="disabledText" type="text" value="Disabled input" disabled> |
| 64 <input id="readOnlyDisabledText" size="20" type="text" value="Readonly Disabled
input"readonly disabled> |
| 65 <textarea id="normalTextArea" cols="31">Normal textarea</textarea> |
| 66 <textarea id="readOnlyTextArea" cols="31" readonly>Readonly textarea</textarea> |
| 67 <textarea id="disabledTextArea" cols="31" disabled>Disabled textarea</textarea> |
| 68 <textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>Readonly Dis
abled textarea</textarea> |
| 69 </body> |
| 70 </html> |
| 71 |
OLD | NEW |