File: activation-trigger-pointerevent.html

package info (click to toggle)
firefox 149.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,767,760 kB
  • sloc: cpp: 7,416,064; javascript: 6,752,859; ansic: 3,774,850; python: 1,250,473; xml: 641,578; asm: 439,191; java: 186,617; sh: 56,634; makefile: 18,856; objc: 13,092; perl: 12,763; pascal: 5,960; yacc: 4,583; cs: 3,846; lex: 1,720; ruby: 1,002; php: 436; lisp: 258; awk: 105; sql: 66; sed: 53; csh: 10; exp: 6
file content (64 lines) | stat: -rw-r--r-- 2,754 bytes parent folder | download | duplicates (16)
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
<!DOCTYPE html>
<html>
<head>
  <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event">
  <meta name="variant" content="?mouse">
  <meta name="variant" content="?pen">
  <meta name="variant" content="?touch">
  <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="resources/utils.js"></script>
</head>
<body onload="runTests()">
  <h1>Test for pointerevent click activation trigger</h1>
  <p>Tests user activation from a pointer click.</p>
  <ol id="instructions">
    <li>Click anywhere in the document.
  </ol>
  <script>
  function runTests() {
    let pointer_type = location.search.substring(1);

    promise_test(async () => {
        const test_pointer = pointer_type + "TestPointer";

        let pointerdown_event = getEvent('pointerdown');
        let pointerup_event = getEvent('pointerup');
        let click_event = getEvent('click');

        await new test_driver.Actions().addPointer(test_pointer, pointer_type)
            .pointerMove(0, 0, {origin:document.body, sourceName:test_pointer})
            .pointerDown({sourceName:test_pointer})
            .pointerUp({sourceName:test_pointer})
            .send();

        await pointerdown_event;
        let consumed_pointerdown = await consumeTransientActivation();
        await pointerup_event;
        let consumed_pointerup = await consumeTransientActivation();
        await click_event;
        let consumed_click = await consumeTransientActivation();

        if (pointer_type === "mouse") {
            assert_true(consumed_pointerdown,
                        pointer_type + " pointerdown event should result in activation");
            assert_false(consumed_pointerup,
                         pointer_type + " pointerup should have no activation after pointerdown consumption");
            assert_false(consumed_click,
                         pointer_type + " click should have no activation after pointerdown consumption");
        } else {
            assert_false(consumed_pointerdown,
                        pointer_type + " pointerdown event should not result in activation");
            assert_true(consumed_pointerup,
                        pointer_type + " pointerup event should result in activation");
            assert_false(consumed_click,
                         pointer_type + " click should have no activation after pointerup consumption");
        }
    }, "Activation through " + pointer_type + " pointerevent click");
  }
  </script>
</body>
</html>