summaryrefslogtreecommitdiffstats
path: root/dom/events/test/pointerevents/wpt/pointerevent_touch-action-verification.html
blob: 7800f2c9da2245ea91ba77158f13d8f0c396f4a8 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!doctype html>
<html>
    <head>
        <title>touch-action: basic verification</title>
        <meta name="assert" content="TA15.20 - The touch-action CSS property determines whether touch input MAY trigger default behavior supplied by the user agent.
        auto: The user agent MAY determine any permitted touch behaviors, such as panning and zooming manipulations of the viewport, for touches that begin on the element. 
        none: Touches that begin on the element MUST NOT trigger default touch behaviors.
        pan-x: The user agent MAY consider touches that begin on the element only for the purposes of horizontally scrolling the element's nearest ancestor with horizontally scrollable content.
        pan-y: The user agent MAY consider touches that begin on the element only for the purposes of vertically scrolling the element's nearest ancestor with vertically scrollable content.
        manipulation: The user agent MAY consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.">
        <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="pointerevent_support.js"></script>
        <style>
          /*
          Give some rules below something to override in order to test
          that they really are being parsed
          */
          .defnone {
          touch-action: none;
          }
        </style>
    </head>
    <body onload="run()">
        <h2>Pointer Events touch-action attribute support</h2>
        <h4 id="desc">Test Description: Test will automatically check parsing behaviour of various touch-action combinations.</h4>
        <script type='text/javascript'>
            var detected_pointertypes = {};

            setup({ explicit_done: true });

            function run() {
                var tests = document.querySelectorAll('.test');
                //TA 15.20
                for (var i = 0; i < tests.length; i++) {
                    test(function() {
                      var style = window.getComputedStyle(tests[i]);
                      assert_equals(tests[i].attributes.expected.value, style.touchAction);
                    }, tests[i].id);
                }
                done();
            }
        </script>
        <h1>touch-action: basic verification</h1>
        <div id="complete-notice">
            <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
        </div>
        <div id="log"></div>
        <div class="test" id="default" expected="auto"></div>
        <div class="test defnone" id="stylesheet-none" expected="none"></div>
        <div class="test defnone" id="explicit-auto" style="touch-action: auto;" expected="auto"></div>
        <div class="test" id="explicit-pan-x" style="touch-action: pan-x;" expected="pan-x"></div>
        <div class="test" id="explicit-pan-left" style="touch-action: pan-left;" expected="pan-left"></div>
        <div class="test" id="explicit-pan-right" style="touch-action: pan-right;" expected="pan-right"></div>
        <div class="test" id="explicit-pan-y" style="touch-action: pan-y;" expected="pan-y"></div>
        <div class="test" id="explicit-pan-up" style="touch-action: pan-up;" expected="pan-up"></div>
        <div class="test" id="explicit-pan-down" style="touch-action: pan-down;" expected="pan-down"></div>
        <div class="test" id="explicit-pan-x-pan-y" style="touch-action: pan-x pan-y;" expected="pan-x pan-y"></div>
        <div class="test" id="explicit-pan-y-pan-x" style="touch-action: pan-y pan-x;" expected="pan-x pan-y"></div>
        <div class="test" id="explicit-pan-left-pan-up" style="touch-action: pan-left pan-up;" expected="pan-left pan-up"></div>
        <div class="test" id="explicit-pan-left-pan-down" style="touch-action: pan-left pan-down;" expected="pan-left pan-down"></div>
        <div class="test" id="explicit-pan-right-pan-up" style="touch-action: pan-right pan-up;" expected="pan-right pan-up"></div>
        <div class="test" id="explicit-pan-right-pan-down" style="touch-action: pan-right pan-down;" expected="pan-right pan-down"></div>
        <div class="test" id="explicit-pan-up-pan-left" style="touch-action: pan-up pan-left;" expected="pan-left pan-up"></div>
        <div class="test" id="explicit-pan-up-pan-right" style="touch-action: pan-up pan-right;" expected="pan-right pan-up"></div>
        <div class="test" id="explicit-pan-down-pan-left" style="touch-action: pan-down pan-left;" expected="pan-left pan-down"></div>
        <div class="test" id="explicit-pan-down-pan-right" style="touch-action: pan-down pan-right;" expected="pan-right pan-down"></div>
        <div class="test" id="explicit-manipulation" style="touch-action: manipulation;" expected="manipulation"></div>
        <div class="test" id="explicit-none" style="touch-action: none;" expected="none"></div>
        <div class="test" id="explicit-invalid-1" style="touch-action: bogus;" expected="auto"></div>
        <div class="test defnone" id="explicit-invalid-2" style="touch-action: auto pan-x;" expected="none"></div>
        <div class="test" id="explicit-invalid-3" style="touch-action: pan-y none;" expected="auto"></div>
        <div class="test" id="explicit-invalid-4" style="touch-action: pan-x pan-x;" expected="auto"></div>
        <div class="test" id="explicit-invalid-5" style="touch-action: manipulation pan-x;" expected="auto"></div>
        <div class="test" id="explicit-invalid-6" style="touch-action: pan-x pan-left;" expected="auto"></div>
        <div class="test" id="explicit-invalid-7" style="touch-action: auto pan-left;" expected="auto"></div>
        <div class="test" id="explicit-invalid-8" style="touch-action: none pan-left;" expected="auto"></div>
        <div class="test" id="explicit-invalid-9" style="touch-action: pan-x pan-right;" expected="auto"></div>
        <div class="test" id="explicit-invalid-10" style="touch-action: pan-y pan-up;" expected="auto"></div>
        <div class="test" id="explicit-invalid-11" style="touch-action: pan-y pan-down;" expected="auto"></div>
        <div class="test" id="explicit-invalid-12" style="touch-action: pan-left pan-right;" expected="auto"></div>
        <div class="test" id="explicit-invalid-13" style="touch-action: pan-up pan-down;" expected="auto"></div>
        <div style="touch-action: none;">
          <div class="test" id="not-inherited" expected="auto"></div>
          <div class="test" id="inherit" style="touch-action: inherit;" expected="none"></div>
        </div>
        <div class="test defnone" id="initial" style="touch-action: initial;" expected="auto"></div>
    </body>
</html>