Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / accessibility / aria-liveregions-attributes.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 </head>
6 <body id="body">
7
8 // This tests that elements that are not live regions do not have the live region attrs.
9 <h3 tabindex=0 id="h3">no live region</h3>
10
11 // These test that they have the correct default values for aria-live.
12
13 <div tabindex=0 id="alert" role="alert">test</div>
14 <div tabindex=0 id="alertdialog" role="alertdialog">test</div>
15 <div tabindex=0 id="log" role="log">test</div>
16 <div tabindex=0 id="status" role="status">test</div>
17 <div tabindex=0 id="timer" role="timer">test</div>
18
19 // These test that elements with live regions on have the right attributes
20 <div tabindex=0 id="liveregion" role="group" aria-busy="true" aria-live="polite" aria-relevant="additions">
21 <h3 tabindex=0 aria-atomic="true" id="h3live">h3</h3>
22 </div>
23
24 <div tabindex=0 id="liveregion2" role="group" aria-live="polite"></div>
25
26 <!-- Default live region values per role. -->
27 <div tabindex=0 id="liveregion_alert" role="alert"><!-- atomic=true, live=assertive --></div>
28 <div tabindex=0 id="liveregion_status" role="status"><!-- atomic=true, live=polite --></div>
29 <div tabindex=0 id="liveregion_log" role="log"><!-- atomic=false, live=polite --></div>
30 <div tabindex=0 id="liveregion_timer" role="timer"><!-- atomic=false, live=off --></div>
31 <div tabindex=0 id="liveregion_marquee" role="marquee"><!-- atomic=false, live=off --></div>
32
33 <p id="description"></p>
34 <div id="console"></div>
35
36 <script>
37
38     description("This tests that the attributes used for ARIA live regions behave correctly.");
39
40     if (window.accessibilityController) {
41   
42           // Make sure that regular elements are not exposing ARIA live attributes.
43           document.getElementById("h3").focus();
44           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXElementBusy')", "true");
45           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIARelevant')", "false");
46           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIAAtomic')", "false");
47           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
48
49           // Make sure that specific aria roles get the right aria live values.
50           document.getElementById("alert").focus();
51           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'assertive'");
52
53           document.getElementById("alertdialog").focus();
54           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'assertive'");
55
56           document.getElementById("log").focus();
57           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
58
59           document.getElementById("status").focus();
60           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
61
62           document.getElementById("timer").focus();
63           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'off'");
64
65           // Test the other attributes for a live region
66           document.getElementById("liveregion").focus();
67           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
68           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIARelevant')", "'additions'");
69           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXElementBusy')", "true");
70
71           document.getElementById("h3live").focus();
72           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
73           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIARelevant')", "false");
74           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "true");
75           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXElementBusy')", "false");
76
77           // when an element has no specific aria-relevant, it should be additions text by default.
78           document.getElementById("liveregion2").focus();
79           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIARelevant')", "'additions text'");
80  
81           document.getElementById("liveregion_alert").focus();
82           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'assertive'");
83           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "true");
84
85           document.getElementById("liveregion_status").focus();
86           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
87           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "true");
88
89           document.getElementById("liveregion_log").focus();
90           shouldBe("accessibilityController.focusedElement.stringAttributeValue('AXARIALive')", "'polite'");
91           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "false");
92
93           document.getElementById("liveregion_timer").focus();
94           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
95           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "false");
96
97           document.getElementById("liveregion_marquee").focus();
98           shouldBe("accessibilityController.focusedElement.isAttributeSupported('AXARIALive')", "false");
99           shouldBe("accessibilityController.focusedElement.boolAttributeValue('AXARIAAtomic')", "false");
100
101     }
102
103 </script>
104
105 <script src="../resources/js-test-post.js"></script>
106 </body>
107 </html>