OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src="../../resources/js-test.js"></script> | |
5 <script src="../../touchadjustment/resources/touchadjustment.js"></script> | |
Yuta Kitamura
2014/10/16 04:01:23
Using this code sounds like an abuse to me, becaus
AKVT
2014/10/16 17:17:14
Done.
| |
6 <script> | |
7 function test() { | |
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."); | |
Yuta Kitamura
2014/10/16 04:01:23
It would be nice if you can add some instruction t
AKVT
2014/10/16 17:17:13
Done. Thanks
| |
16 return; | |
17 } | |
18 | |
19 // Normal Text | |
20 doLongPressOnElement("normalText"); | |
21 | |
22 // ReadOnly Text | |
23 doLongPressOnElement("readOnlyText"); | |
24 | |
25 // Disabled Text | |
26 doLongPressOnElement("disabledText"); | |
27 | |
28 // ReadOnly and Disabled Text | |
29 doLongPressOnElement("readOnlyDisabledText"); | |
30 | |
31 // Normal TextArea | |
32 doLongPressOnElement("normalTextArea"); | |
33 | |
34 // ReadOnly TextArea | |
35 doLongPressOnElement("readOnlyTextArea"); | |
36 | |
37 // Disabled TextArea | |
38 doLongPressOnElement("disabledTextArea"); | |
39 | |
40 // ReadOnly and Disabled TextArea | |
41 doLongPressOnElement("readOnlyDisabledTextArea"); | |
42 } | |
43 | |
44 function doLongPressOnElement(elementId) { | |
45 var element = document.getElementById(elementId); | |
46 var bounds = element.getBoundingClientRect(); | |
47 var middleX = (bounds.left + bounds.right) / 2; | |
48 var middleY = (bounds.top + bounds.bottom) / 2; | |
49 // Touch directly in the center of the element. | |
50 var touchPoint = offsetTouchPoint(findAbsoluteBounds(element), 'center', 0, 0, 0); | |
51 window.eventSender.gestureLongPress(touchPoint.x, touchPoint.y); | |
52 shouldBeNode(document.elementFromPoint(middleX, middleY), element); | |
53 } | |
54 </script> | |
55 </head> | |
56 <body onload="test();"> | |
Yuta Kitamura
2014/10/16 04:01:23
I would recommend setting jsTestIsAsync to true (a
AKVT
2014/10/16 17:17:13
Done. Thank you
| |
57 <input id="normalText" type="text" value="Normal input"> | |
58 <input id="readOnlyText" type="text" value="Readonly input" readonly> | |
59 <input id="disabledText" type="text" value="Disabled input" disabled> | |
60 <input id="readOnlyDisabledText" size="20" type="text" value="Readonly and Disab led input" readonly disabled> | |
61 <textarea id="normalTextArea" cols="31">Normal textarea</textarea> | |
62 <textarea id="readOnlyTextArea" cols="31" readonly>Readonly textarea</textarea> | |
63 <textarea id="disabledTextArea" cols="31" disabled>Disabled textarea</textarea> | |
64 <textarea id="readOnlyDisabledTextArea" cols="31" readonly disabled>Readonly Dis abled textarea</textarea> | |
65 </body> | |
66 </html> | |
67 | |
OLD | NEW |