3 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
4 <script src="../fast/js/resources/js-test-pre.js"></script>
8 <p id="description"></p>
10 <select id="select" value="Select"><option>A<option>B</select>
12 <div id="slider" tabindex="0" role="slider" aria-valuenow="5">Slider</div>
14 <div id="console"></div>
17 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.");
20 if (window.testRunner)
21 testRunner.waitUntilDone();
23 window.jsTestIsAsync = true;
25 window.selectNotificationCount = 0;
26 window.sliderNotificationCount = 0;
27 window.globalNotificationCount = 0;
29 if (window.accessibilityController) {
30 document.getElementById("select").focus();
31 window.select = accessibilityController.focusedElement;
32 select.addNotificationListener(function(notification) {
33 selectNotificationCount++;
34 debug("SELECT " + notification);
37 document.getElementById("slider").focus();
38 window.slider = accessibilityController.focusedElement;
39 slider.addNotificationListener(function(notification) {
40 sliderNotificationCount++;
41 debug("SLIDER " + notification);
44 accessibilityController.addNotificationListener(function(element, notification) {
45 if (element.isEqual(slider) || element.isEqual(select)) {
46 globalNotificationCount++;
47 debug("GLOBAL " + notification + " on element with role " + element.role);
52 // This should trigger a "invalid status changed" notification on the select.
53 document.getElementById("select").setAttribute("aria-invalid", "true");
55 // This should trigger a "value changed" notification on the slider.
56 document.getElementById("slider").setAttribute("aria-valuenow", "6");
58 window.setTimeout(function() {
59 shouldBe("selectNotificationCount", "1");
60 shouldBe("sliderNotificationCount", "1");
61 shouldBe("globalNotificationCount", "2");
63 if (window.accessibilityController) {
64 accessibilityController.removeNotificationListener();
65 select.removeNotificationListener();
66 slider.removeNotificationListener();
77 <script src="../fast/js/resources/js-test-post.js"></script>