[Web GPU] GPURenderPassEncoder updates: setBlendColor, setViewport, setScissorRect
[WebKit-https.git] / LayoutTests / accessibility / notification-listeners.html
1 <html>
2 <head>
3 <script src="../resources/js-test-pre.js"></script>
4 </head>
5 <body>
6
7 <p id="description"></p>
8
9 <select id="select" value="Select"></select>
10
11 <div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div>
12
13 <div id="console"></div>
14
15 <script>
16 description("This tests that a notification listener on an element only listens to that one element, and that a global notification listener listens to all notifications.");
17
18 function runTest() {
19     window.jsTestIsAsync = true;
20
21     window.selectNotificationCount = 0;
22     window.sliderNotificationCount = 0;
23     window.globalNotificationCount = 0;
24
25     if (window.accessibilityController) {
26         document.getElementById("select").focus();
27         window.select = accessibilityController.focusedElement;
28         select.addNotificationListener(function(notification) {
29             selectNotificationCount++;
30             debug("SELECT " + notification);
31         });
32
33         document.getElementById("slider").focus();
34         window.slider = accessibilityController.focusedElement;
35         slider.addNotificationListener(function(notification) {
36             sliderNotificationCount++;
37             debug("SLIDER " + notification);
38         });
39
40         accessibilityController.addNotificationListener(function(element, notification) {
41             if (element.isEqual(slider) || element.isEqual(select)) {
42                 globalNotificationCount++;
43                 debug("GLOBAL " + notification + " on element with role " + element.role);
44             }
45         });
46     }
47
48     // Ensure these elements exist in the AX tree otherwise notifications won't be generated.
49     accessibilityController.accessibleElementById("select");
50     accessibilityController.accessibleElementById("slider");
51
52     // This should trigger a "invalid status changed" notification on the select.
53     document.getElementById("select").setAttribute("aria-invalid", "true");
54
55     // This should trigger a "value changed" notification on the slider.
56     document.getElementById("slider").setAttribute("aria-valuenow", "6");
57
58     window.setTimeout(function() {
59         shouldBe("selectNotificationCount", "1");
60         shouldBe("sliderNotificationCount", "1");
61         shouldBe("globalNotificationCount", "2");
62
63         if (window.accessibilityController) {
64             accessibilityController.removeNotificationListener();
65             select.removeNotificationListener();
66             slider.removeNotificationListener();
67         }
68
69         finishJSTest();
70     }, 10);
71 }
72
73 runTest();
74
75 </script>
76
77 <script src="../resources/js-test-post.js"></script>
78 </body>
79 </html>