summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/touch-events/single-touch-vertical-rl.html
blob: 857007b1f8a5c548da2e2c306cb80bdea96bf2e5 (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Touch events with vertical-rl writing mode</title>
  <meta name="viewport" content="width=device-width">
  <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>
    setup({explicit_done: true});

    async function run() {
      document.documentElement.addEventListener("touchstart", function onTouchStart(event) {
        test(function() {
          assert_equals(event.changedTouches[0].clientX, 10, "clientX");
          assert_equals(event.changedTouches[0].clientY, 20, "clientY");
        }, "touchstart client coordinates are correct in vertical-rl");
      });

      document.documentElement.addEventListener("click", function onClick(event) {
        test(function() {
          assert_equals(event.clientX, 10, "clientX");
          assert_equals(event.clientY, 20, "clientY");
        }, "click client coordinates are correct in vertical-rl");
        done();
      });

      let actions = new test_driver.Actions()
          .addPointer("touchPointer1", "touch")
          .pointerMove(10, 20)
          .pointerDown()
          .pointerUp();
      actions.send();
    }
  </script>
  <style>
    body {
      margin: 0;
      writing-mode: vertical-rl;
    }
    .forcescroll {
      width: 5000px;
      height: 20px;
    }
  </style>
</head>
<body onload="run()">
  <div class="forcescroll"></div>
</body>
</html>