OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>touch-action: pan-y</title> | 4 <title>touch-action: pan-down</title> |
5 <meta name="assert" content="TA15.4 - With `touch-action: pan-y` on a sw
iped or click/dragged element, only panning in the y-axis should be possible."> | 5 <meta name="assert" content="TA15.4 - With `touch-action: pan-down` on a
swiped or click/dragged element, only panning in the y-axis down direction shou
ld be possible."> |
6 <meta name="viewport" content="width=device-width"> | 6 <meta name="viewport" content="width=device-width"> |
7 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> | 7 <link rel="stylesheet" type="text/css" href="pointerevent_styles.css"> |
8 <script src="/resources/testharness.js"></script> | 8 <script src="/resources/testharness.js"></script> |
9 <script src="/resources/testharnessreport.js"></script> | 9 <script src="/resources/testharnessreport.js"></script> |
10 <script src="pointerevent_support.js"></script> | 10 <script src="pointerevent_support.js"></script> |
11 <style> | 11 <style> |
12 #target0 { | 12 #target0 { |
13 width: 700px; | 13 width: 700px; |
14 height: 430px; | 14 height: 430px; |
15 touch-action: pan-y; | 15 touch-action: pan-down; |
16 } | 16 } |
17 </style> | 17 </style> |
18 </head> | 18 </head> |
19 <body onload="run()"> | 19 <body onload="run()"> |
20 <h1>Pointer Events touch-action attribute support</h1> | 20 <h1>Pointer Events touch-action attribute support</h1> |
21 <h4 id="desc">Test Description: Try to scroll element DOWN then RIGHT. T
ap Complete button under the rectangle when done. Expected: only pans in y direc
tion.</h4> | 21 <h4 id="desc">Test Description: Try to scroll element UP (drag down), th
en RIGHT (drag left), then DOWN (drag up). Tap Complete button under the rectang
le when done. Expected: only pans in down direction.</h4> |
22 <p>Note: this test is for touch-devices only</p> | 22 <p>Note: this test is for touch-devices only</p> |
23 <div id="target0"> | 23 <div id="target0"> |
24 <p> | 24 <p> |
25 Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed di
em | 25 Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed di
em |
26 nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam e
rat volutpat. | 26 nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam e
rat volutpat. |
27 Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamc
orper suscipit | 27 Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamc
orper suscipit |
28 lobortis nisl ut aliquip ex ea commodo consequat. | 28 lobortis nisl ut aliquip ex ea commodo consequat. |
29 </p> | 29 </p> |
30 <p>Lorem ipsum dolor sit amet...</p> | 30 <p>Lorem ipsum dolor sit amet...</p> |
31 <p>Lorem ipsum dolor sit amet...</p> | 31 <p>Lorem ipsum dolor sit amet...</p> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 </div> | 76 </div> |
77 <input type="button" id="btnComplete" value="Complete test"> | 77 <input type="button" id="btnComplete" value="Complete test"> |
78 <script type='text/javascript'> | 78 <script type='text/javascript'> |
79 var detected_pointertypes = {}; | 79 var detected_pointertypes = {}; |
80 var test_touchaction = async_test("touch-action attribute test"); | 80 var test_touchaction = async_test("touch-action attribute test"); |
81 add_completion_callback(showPointerTypes); | 81 add_completion_callback(showPointerTypes); |
82 | 82 |
83 function run() { | 83 function run() { |
84 var target0 = document.getElementById("target0"); | 84 var target0 = document.getElementById("target0"); |
85 var btnComplete = document.getElementById("btnComplete"); | 85 var btnComplete = document.getElementById("btnComplete"); |
| 86 target0.scrollTop = 200; |
86 | 87 |
87 // Check if "touch-action: pan-y" attribute works properly | 88 var scrollListenerExecuted = false; |
| 89 target0.addEventListener("scroll", function(event) { |
| 90 scrollListenerExecuted = true; |
| 91 assert_greater_than_equal(target0.scrollTop, 200); |
| 92 }); |
| 93 |
| 94 // Check if "touch-action: pan-down" attribute works properly |
88 //TA: 15.4 | 95 //TA: 15.4 |
89 on_event(btnComplete, 'click', function(event) { | 96 on_event(btnComplete, 'click', function(event) { |
90 detected_pointertypes[event.pointerType] = true; | 97 detected_pointertypes[event.pointerType] = true; |
91 test_touchaction.step(function() { | 98 test_touchaction.step(function() { |
| 99 assert_true(scrollListenerExecuted, "scroll listener sho
uld have been executed by the end of the test"); |
92 assert_equals(target0.scrollLeft, 0, "scroll x offset sh
ould be 0 in the end of the test"); | 100 assert_equals(target0.scrollLeft, 0, "scroll x offset sh
ould be 0 in the end of the test"); |
93 assert_not_equals(target0.scrollTop, 0, "scroll y offset
should not be 0 in the end of the test"); | 101 assert_greater_than(target0.scrollTop, 200, "scroll y of
fset should be greater than 200 in the end of the test"); |
94 }); | 102 }); |
95 test_touchaction.done(); | 103 test_touchaction.done(); |
96 updateDescriptionComplete(); | 104 updateDescriptionComplete(); |
97 }); | 105 }); |
98 } | 106 } |
99 </script> | 107 </script> |
100 <h1>touch-action: pan-y</h1> | 108 <h1>touch-action: pan-down</h1> |
101 <div id="complete-notice"> | 109 <div id="complete-notice"> |
102 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> | 110 <p>The following pointer types were detected: <span id="pointertype-
log"></span>.</p> |
103 </div> | 111 </div> |
104 <div id="log"></div> | 112 <div id="log"></div> |
105 </body> | 113 </body> |
106 </html> | 114 </html> |
OLD | NEW |