summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/pointerevents/pointerevent_touch-action-modified_touch.html
blob: a91022504a7ebf8dee21a368b5911285ef614e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!doctype html>
<html>
    <head>
        <title>Deleting touch-action elem after pointerdown has no effect</title>
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>
        <script src="/resources/testdriver.js"></script>
        <script src="/resources/testdriver-actions.js"></script>
        <script src="/resources/testdriver-vendor.js"></script>
        <script src="pointerevent_support.js"></script>
        <style>
          div.box {
              margin: 10px;
              height: 25vh;
              border: 1px solid black;
          }
          #target {
              background-color: lightgreen;
              touch-action:none;
          }
        </style>
    </head>
    <body>
        <h1>Deleting touch-action elem after pointerdown has no effect</h1>
        <h4 id="desc">
          Try to scroll up/down starting at the green element.  Expectation: the
          green element would vanish immediately and the content won't scroll.
        </h4>
        <p>Note: this test is for touch-devices only</p>
        <div class="box"></div>
        <div class="box"></div>
        <div class="box" id="target">Drag up or down from here</div>
        <div class="box"></div>
        <div class="box"></div>
    </body>
    <script>
      let target = document.getElementById("target");
      let pointercancel_received = false;

      document.body.addEventListener("pointerdown", () => target.parentElement.removeChild(target));
      document.body.addEventListener("pointercancel", () => pointercancel_received = true);

      let detected_pointertypes = {};
      add_completion_callback(showPointerTypes);

      promise_test(async () => {
          let pointerup_event = getEvent("pointerup", document.body);

          await touchScrollInTarget(target, "down");
          await pointerup_event;

          assert_false(pointercancel_received,
                       "a pointercancel event is unexpected because there should be no scrolling");

          updateDescriptionComplete();
      }, "Deleting touch-action elem after pointerdown");
    </script>
</html>