pointerevent_touch-propagates-when-target-is-video_touch.html (1569B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Touch-generated events should propagate to the parent when a video element is the target</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <script src="/resources/testdriver-actions.js"></script> 9 <div id="log"></div> 10 11 <div id="parent"> 12 <video controls="" preload="auto" width="480" height="320"></video> 13 </div> 14 15 <script> 16 const parent = document.getElementById('parent'); 17 const video = document.querySelector('video'); 18 19 const xPosition = Math.ceil(video.offsetLeft + 2); 20 const yPosition = Math.ceil(video.offsetTop + 2); 21 22 promise_test(async t => { 23 await new Promise(r => { 24 const expectedEventLog = ['touchstart-VIDEO', 'touchmove-VIDEO', 'touchend-VIDEO']; 25 const eventLogRecorder = []; 26 const eventNames = ['touchstart', 'touchmove', 'touchend']; 27 28 for (eventName of eventNames) { 29 parent.addEventListener(eventName, event => { 30 eventLogRecorder.push(`${event.type}-${event.target.nodeName}`); 31 if (event.type === 'touchend') { 32 assert_array_equals(eventLogRecorder, expectedEventLog); 33 r(); 34 } 35 }); 36 } 37 let actions = new test_driver.Actions(); 38 actions 39 .addPointer("touchPointer", "touch") 40 .setPointer("touchPointer") 41 .pointerMove(xPosition, yPosition) 42 .pointerDown() 43 .pointerMove(3, 3, video) 44 .pointerUp() 45 .send(); 46 }); 47 }); 48 </script>