summaryrefslogtreecommitdiffstats
path: root/remote/test/puppeteer/test/assets/input/touches.html
blob: 4392cfacbd5bbaa389fa53dc5fc2aa9bd56c79a5 (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
<!DOCTYPE html>
<html>
  <head>
    <title>Touch test</title>
  </head>
  <body>
    <script src="mouse-helper.js"></script>
    <button onclick="clicked();">Click target</button>
    <script>
      window.result = [];
      const button = document.querySelector('button');
      button.style.height = '200px';
      button.style.width = '200px';
      button.focus();
      button.addEventListener('touchstart', event => {
        log('Touchstart:', ...Array.from(event.changedTouches).map(touch => touch.identifier));
      });
      button.addEventListener('touchend', event => {
        log('Touchend:', ...Array.from(event.changedTouches).map(touch => touch.identifier));
      });
      button.addEventListener('touchmove', event => {
        log('Touchmove:', ...Array.from(event.changedTouches).map(touch => touch.identifier));
      });
      function log(...args) {
        console.log.apply(console, args);
        result.push(args.join(' '));
      }
      function getResult() {
        let temp = result;
        result = [];
        return temp;
      }
    </script>
  </body>
</html>