OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 | 4 |
5 <style> | 5 <style> |
6 .hideAllContainers .container { | 6 .hideAllContainers .container { |
7 display: none; | 7 display: none; |
8 } | 8 } |
9 </style> | 9 </style> |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 <button id="labelledby" aria-labelledby="label1">Contents</button> | 35 <button id="labelledby" aria-labelledby="label1">Contents</button> |
36 <div id="label1">Label 1</div> | 36 <div id="label1">Label 1</div> |
37 </div> | 37 </div> |
38 | 38 |
39 <script> | 39 <script> |
40 test(function(t){ | 40 test(function(t){ |
41 var axLabelledby = accessibilityController.accessibleElementById("labelledby
"); | 41 var axLabelledby = accessibilityController.accessibleElementById("labelledby
"); |
42 assert_equals(axLabelledby.name, "Label 1"); | 42 assert_equals(axLabelledby.name, "Label 1"); |
43 assert_equals(axLabelledby.nameFrom, "relatedElement"); | 43 assert_equals(axLabelledby.nameFrom, "relatedElement"); |
44 assert_equals(axLabelledby.nameElementCount(), 1); | 44 assert_equals(axLabelledby.nameElementCount(), 1); |
45 assert_equals(axLabelledby.nameElementAtIndex(0).role, "AXRole: AXDiv"); | 45 assert_equals(axLabelledby.nameElementAtIndex(0).role, "AXRole: AXGenericCon
tainer"); |
46 }, "Button with aria-labelledby referencing the id of another element."); | 46 }, "Button with aria-labelledby referencing the id of another element."); |
47 </script> | 47 </script> |
48 | 48 |
49 <div class="container"> | 49 <div class="container"> |
50 <button id="labelledby2" aria-labelledby="labelledby2">Contents</button> | 50 <button id="labelledby2" aria-labelledby="labelledby2">Contents</button> |
51 </div> | 51 </div> |
52 | 52 |
53 <script> | 53 <script> |
54 test(function(t){ | 54 test(function(t){ |
55 var axLabelledby2 = accessibilityController.accessibleElementById("labelledb
y2"); | 55 var axLabelledby2 = accessibilityController.accessibleElementById("labelledb
y2"); |
56 assert_equals(axLabelledby2.name, "Contents"); | 56 assert_equals(axLabelledby2.name, "Contents"); |
57 assert_equals(axLabelledby2.nameFrom, "relatedElement"); | 57 assert_equals(axLabelledby2.nameFrom, "relatedElement"); |
58 assert_equals(axLabelledby2.nameElementCount(), 1); | 58 assert_equals(axLabelledby2.nameElementCount(), 1); |
59 assert_equals(axLabelledby2.nameElementAtIndex(0).role, "AXRole: AXButton"); | 59 assert_equals(axLabelledby2.nameElementAtIndex(0).role, "AXRole: AXButton"); |
60 }, "Button with aria-labelledby referencing itself."); | 60 }, "Button with aria-labelledby referencing itself."); |
61 </script> | 61 </script> |
62 | 62 |
63 <div class="container"> | 63 <div class="container"> |
64 <button id="labelledby3" aria-labelledby="labelledby3 label3">Contents</butt
on> | 64 <button id="labelledby3" aria-labelledby="labelledby3 label3">Contents</butt
on> |
65 <div id="label3">Label 3</div> | 65 <div id="label3">Label 3</div> |
66 </div> | 66 </div> |
67 | 67 |
68 <script> | 68 <script> |
69 test(function(t){ | 69 test(function(t){ |
70 var axLabelledby3 = accessibilityController.accessibleElementById("labelledb
y3"); | 70 var axLabelledby3 = accessibilityController.accessibleElementById("labelledb
y3"); |
71 assert_equals(axLabelledby3.name, "Contents Label 3"); | 71 assert_equals(axLabelledby3.name, "Contents Label 3"); |
72 assert_equals(axLabelledby3.nameFrom, "relatedElement"); | 72 assert_equals(axLabelledby3.nameFrom, "relatedElement"); |
73 assert_equals(axLabelledby3.nameElementCount(), 2); | 73 assert_equals(axLabelledby3.nameElementCount(), 2); |
74 assert_equals(axLabelledby3.nameElementAtIndex(0).role, "AXRole: AXButton"); | 74 assert_equals(axLabelledby3.nameElementAtIndex(0).role, "AXRole: AXButton"); |
75 assert_equals(axLabelledby3.nameElementAtIndex(1).role, "AXRole: AXDiv"); | 75 assert_equals(axLabelledby3.nameElementAtIndex(1).role, "AXRole: AXGenericCo
ntainer"); |
76 }, "Button with aria-labelledby referencing itself and the id of another element
."); | 76 }, "Button with aria-labelledby referencing itself and the id of another element
."); |
77 </script> | 77 </script> |
78 | 78 |
79 <div class="container"> | 79 <div class="container"> |
80 <button id="labelledby4" aria-labelledby="label4">Contents</button> | 80 <button id="labelledby4" aria-labelledby="label4">Contents</button> |
81 <div id="label4" aria-labelledby="label4chained">Contents 4</div> | 81 <div id="label4" aria-labelledby="label4chained">Contents 4</div> |
82 <p id="label4chained">Contents 4 chained</p> | 82 <p id="label4chained">Contents 4 chained</p> |
83 </div> | 83 </div> |
84 | 84 |
85 <script> | 85 <script> |
86 test(function(t){ | 86 test(function(t){ |
87 var axLabelledby4 = accessibilityController.accessibleElementById("labelledb
y4"); | 87 var axLabelledby4 = accessibilityController.accessibleElementById("labelledb
y4"); |
88 assert_equals(axLabelledby4.name, "Contents 4"); | 88 assert_equals(axLabelledby4.name, "Contents 4"); |
89 assert_equals(axLabelledby4.nameFrom, "relatedElement"); | 89 assert_equals(axLabelledby4.nameFrom, "relatedElement"); |
90 assert_equals(axLabelledby4.nameElementCount(), 1); | 90 assert_equals(axLabelledby4.nameElementCount(), 1); |
91 assert_equals(axLabelledby4.nameElementAtIndex(0).role, "AXRole: AXDiv"); | 91 assert_equals(axLabelledby4.nameElementAtIndex(0).role, "AXRole: AXGenericCo
ntainer"); |
92 }, "Button with chain of aria-labelledby references."); | 92 }, "Button with chain of aria-labelledby references."); |
93 </script> | 93 </script> |
94 | 94 |
95 <div class="container"> | 95 <div class="container"> |
96 <button id="labelledby5" aria-labelledby="label5">Contents</button> | 96 <button id="labelledby5" aria-labelledby="label5">Contents</button> |
97 </div> | 97 </div> |
98 | 98 |
99 <script> | 99 <script> |
100 test(function(t){ | 100 test(function(t){ |
101 var axLabelledby5 = accessibilityController.accessibleElementById("labelledb
y5"); | 101 var axLabelledby5 = accessibilityController.accessibleElementById("labelledb
y5"); |
102 assert_equals(axLabelledby5.name, "Contents"); | 102 assert_equals(axLabelledby5.name, "Contents"); |
103 assert_equals(axLabelledby5.nameFrom, "contents"); | 103 assert_equals(axLabelledby5.nameFrom, "contents"); |
104 assert_equals(axLabelledby5.nameElementCount(), 0); | 104 assert_equals(axLabelledby5.nameElementCount(), 0); |
105 }, "aria-labelledby reference to nonexistant element."); | 105 }, "aria-labelledby reference to nonexistant element."); |
106 </script> | 106 </script> |
107 | 107 |
108 <div class="container"> | 108 <div class="container"> |
109 <button id="labelledby6" aria-labelledby="label6">Contents</button> | 109 <button id="labelledby6" aria-labelledby="label6">Contents</button> |
110 <div id="label6"></div> | 110 <div id="label6"></div> |
111 </div> | 111 </div> |
112 | 112 |
113 <script> | 113 <script> |
114 test(function(t){ | 114 test(function(t){ |
115 var axLabelledby6 = accessibilityController.accessibleElementById("labelledb
y6"); | 115 var axLabelledby6 = accessibilityController.accessibleElementById("labelledb
y6"); |
116 assert_equals(axLabelledby6.name, ""); | 116 assert_equals(axLabelledby6.name, ""); |
117 assert_equals(axLabelledby6.nameFrom, "relatedElement"); | 117 assert_equals(axLabelledby6.nameFrom, "relatedElement"); |
118 assert_equals(axLabelledby6.nameElementCount(), 1); | 118 assert_equals(axLabelledby6.nameElementCount(), 1); |
119 assert_equals(axLabelledby6.nameElementAtIndex(0).role, "AXRole: AXDiv"); | 119 assert_equals(axLabelledby6.nameElementAtIndex(0).role, "AXRole: AXGenericCo
ntainer"); |
120 }, "aria-labelledby reference to element with no text."); | 120 }, "aria-labelledby reference to element with no text."); |
121 </script> | 121 </script> |
122 | 122 |
123 <div class="container"> | 123 <div class="container"> |
124 <button id="labelledby7" aria-labelledby="label7">Contents</button> | 124 <button id="labelledby7" aria-labelledby="label7">Contents</button> |
125 <h3 id="label7" style="visibility: hidden">Invisible label</h3> | 125 <h3 id="label7" style="visibility: hidden">Invisible label</h3> |
126 </div> | 126 </div> |
127 | 127 |
128 <script> | 128 <script> |
129 test(function(t){ | 129 test(function(t){ |
(...skipping 19 matching lines...) Expand all Loading... |
149 assert_equals(axLabelledby8.nameFrom, "relatedElement"); | 149 assert_equals(axLabelledby8.nameFrom, "relatedElement"); |
150 assert_equals(axLabelledby8.nameElementCount(), 1); | 150 assert_equals(axLabelledby8.nameElementCount(), 1); |
151 assert_equals(axLabelledby8.nameElementAtIndex(0).role, "AXRole: AXHeading")
; | 151 assert_equals(axLabelledby8.nameElementAtIndex(0).role, "AXRole: AXHeading")
; |
152 }, "Button with aria-labelledby reference to display-none element."); | 152 }, "Button with aria-labelledby reference to display-none element."); |
153 </script> | 153 </script> |
154 | 154 |
155 <script> | 155 <script> |
156 if (window.testRunner) | 156 if (window.testRunner) |
157 document.body.className = "hideAllContainers"; | 157 document.body.className = "hideAllContainers"; |
158 </script> | 158 </script> |
OLD | NEW |