|
| 1 | +<!DOCTYPE HTML> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <title>TouchEvent Retargeting Tests</title> |
| 5 | + <script src="/resources/testharness.js"></script> |
| 6 | + <script src="/resources/testharnessreport.js"></script> |
| 7 | +</head> |
| 8 | +<body> |
| 9 | + <h1>Touch retargeting manual test</h1> |
| 10 | + <div>This test requires touch input.</div> |
| 11 | + <div id="host"></div> |
| 12 | +</body> |
| 13 | +<script> |
| 14 | + var host = document.getElementById("host"); |
| 15 | + var root = host.attachShadow({ mode: "open" }); |
| 16 | + var target = document.createElement("h2"); |
| 17 | + target.textContent = "Tap on THIS line of text"; |
| 18 | + root.appendChild(target); |
| 19 | + |
| 20 | + var test_touch_retargeting = async_test("touch_retargeting"); |
| 21 | + |
| 22 | + on_event(host, "touchstart", e => { |
| 23 | + test_touch_retargeting.step(() => { |
| 24 | + assert_equals(e.touches.length, 1, "touches.length is correct"); |
| 25 | + assert_equals(e.touches[0].target, host, "touches[0] is retargeted to host"); |
| 26 | + |
| 27 | + assert_equals(e.targetTouches.length, 1, "targetTouches.length is correct"); |
| 28 | + assert_equals(e.targetTouches[0].target, host, "targetTouches[0] is retargeted to host"); |
| 29 | + |
| 30 | + assert_equals(e.changedTouches.length, 1, "changedTouches.length is correct"); |
| 31 | + assert_equals(e.changedTouches[0].target, host, "changedTouches[0] is retargeted to host"); |
| 32 | + }); |
| 33 | + }); |
| 34 | + on_event(host, "touchend", e => test_touch_retargeting.done()); |
| 35 | +</script> |
| 36 | +</html> |
0 commit comments