OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <body> | |
bokan
2016/09/19 21:13:18
Nit: no <body> tag
| |
5 For manual testing, Select some text and drag the mouse close to the bottom | |
6 (do not reach the border) before releasing. | |
7 <div id="scrollable" style="height: 100px; overflow: auto; border: solid 3px #cc0000"> | |
8 <p>This is a very long sentence to take up some space.</p> | |
9 <p>This is a very long sentence to take up some space.</p> | |
10 <p>This is a very long sentence to take up some space.</p> | |
11 <p>This is a very long sentence to take up some space.</p> | |
12 <p>This is a very long sentence to take up some space.</p> | |
13 <p>This is a very long sentence to take up some space.</p> | |
14 <p>This is a very long sentence to take up some space.</p> | |
15 <p>This is a very long sentence to take up some space.</p> | |
16 <p>This is a very long sentence to take up some space.</p> | |
17 <p>This is a very long sentence to take up some space.</p> | |
18 </div> | |
19 </body> | |
20 <script> | |
21 var scrollable = document.getElementById("scrollable"); | |
22 var retryCount = 0; | |
23 var testAutoscroll = async_test('Selection-autoscroll should be triggered when t he mouse is within the border belt'); | |
24 testAutoscroll.step(function() { | |
25 function checkScrolled() { | |
26 console.log(scrollable.scrollTop); | |
bokan
2016/09/19 21:13:18
Please remove the logging output.
| |
27 if (scrollable.scrollTop > 0) { | |
28 testAutoscroll.done(); | |
29 return; | |
30 } | |
31 ++retryCount; | |
32 if (retryCount > 4) { | |
33 assert_true(false); | |
34 testAutoscroll.done(); | |
35 return; | |
36 } | |
37 // Autoscroll is occurred evey 0.05 sec. | |
bokan
2016/09/19 21:13:18
Where does this constant come from? I see Autoscro
| |
38 window.setTimeout(checkScrolled, 50); | |
bokan
2016/09/19 21:13:18
We generally avoid using window.setTimeout in test
| |
39 return; | |
40 } | |
41 | |
42 if (!window.eventSender) | |
43 return; | |
44 | |
45 var dragStartX = scrollable.offsetLeft + 20; | |
46 var dragStartY = scrollable.offsetTop + 5; | |
47 var dragEndX = dragStartX; | |
48 var dragEndY = scrollable.offsetTop + scrollable.offsetHeight - 10; | |
49 | |
50 eventSender.dragMode = false; | |
51 eventSender.mouseMoveTo(dragStartX, dragStartY); | |
52 eventSender.mouseDown(); | |
53 eventSender.mouseMoveTo(dragEndX, dragEndY); | |
54 | |
55 checkScrolled(); | |
56 }); | |
57 </script> | |
OLD | NEW |