Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/aom.html

Issue 2796553002: Revert of Initial skeleton of Accessibility Object Model Phase 1 (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <script src="../resources/gc.js"></script>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5
6 <!--
7
8 Accessibility Object Model
9 Explainer: https://github.com/WICG/aom/blob/master/explainer.md
10 Spec: https://wicg.github.io/aom/spec/
11
12 -->
13
14 <button id="button">Click Me</button>
15
16 <script>
17 if (window.internals)
18 internals.runtimeFlags.accessibilityObjectModelEnabled = true;
19
20 test(function(t) {
21 var button = document.getElementById("button");
22 assert_equals(button.nodeType, Node.ELEMENT_NODE);
23 assert_not_equals(button.accessibleNode, null);
24 }, "DOM Elements have an AccessibleNode");
25
26 test(function(t) {
27 var button = document.getElementById("button");
28 var staticText = button.firstChild;
29 assert_equals(staticText.nodeType, Node.TEXT_NODE);
30 assert_not_equals(staticText.accessibleNode, null);
31 }, "DOM Text nodes do not have an AccessibleNode.");
32
33 test(function(t) {
34 var button = document.getElementById("button");
35 var aomButton = button.accessibleNode;
36
37 assert_equals(aomButton.role, null);
38 assert_equals(aomButton.label, null);
39 assert_equals(aomButton.foo, undefined);
40 assert_equals(aomButton.bar, undefined);
41 }, "Supported properties on an AccessibleNode are all null by default");
42
43 test(function(t) {
44 var button = document.getElementById("button");
45 var aomButton = button.accessibleNode;
46 var axButton = accessibilityController.accessibleElementById("button");
47
48 button.setAttribute("role", "checkbox");
49 button.setAttribute("aria-label", "Check Me");
50
51 assert_equals(axButton.role, "AXRole: AXCheckBox");
52 assert_equals(axButton.name, "Check Me");
53
54 assert_equals(aomButton.role, "checkbox");
55 assert_equals(aomButton.label, "Check Me");
56 }, "ARIA attributes are reflected into AOM properties");
57
58 test(function(t) {
59 var button = document.getElementById("button");
60 var aomButton = button.accessibleNode;
61 var axButton = accessibilityController.accessibleElementById("button");
62
63 button.setAttribute("role", "beyonce");
64
65 assert_equals(axButton.role, "AXRole: AXButton");
66
67 assert_equals(aomButton.role, "beyonce");
68 }, "Invalid ARIA roles are still reflected into AOM properties");
69
70 test(function(t) {
71 var button = document.getElementById("button");
72 var aomButton = button.accessibleNode;
73 var axButton = accessibilityController.accessibleElementById("button");
74
75 aomButton.role = "slider";
76 assert_equals(aomButton.role, "slider");
77 assert_equals(axButton.role, "AXRole: AXSlider");
78 }, "Test setting AccessibleNode.role");
79
80 test(function(t) {
81 var button = document.getElementById("button");
82 var aomButton = button.accessibleNode;
83 var axButton = accessibilityController.accessibleElementById("button");
84
85 button.removeAttribute("role");
86 aomButton.role = null;
87 assert_equals(aomButton.role, null);
88 assert_equals(axButton.role, "AXRole: AXButton");
89
90 aomButton.role = "doctor";
91 assert_equals(aomButton.role, "doctor");
92 assert_equals(axButton.role, "AXRole: AXButton");
93 }, "An invalid role should be ignored if there's no ARIA.");
94
95 test(function(t) {
96 var button = document.getElementById("button");
97 var aomButton = button.accessibleNode;
98 var axButton = accessibilityController.accessibleElementById("button");
99
100 aomButton.role = "switch checkbox";
101 assert_equals(aomButton.role, "switch checkbox");
102 assert_equals(axButton.role, "AXRole: AXSwitch");
103
104 aomButton.role = "tickbox checkbox";
105 assert_equals(aomButton.role, "tickbox checkbox");
106 assert_equals(axButton.role, "AXRole: AXCheckBox");
107 }, "Fallback roles are supported.");
108
109 test(function(t) {
110 var button = document.getElementById("button");
111 var aomButton = button.accessibleNode;
112 var axButton = accessibilityController.accessibleElementById("button");
113
114 button.removeAttribute("aria-label");
115 aomButton.label = "New Label";
116 assert_equals(aomButton.label, "New Label");
117 assert_equals(axButton.name, "New Label");
118 }, "Test setting AccessibleNode.label");
119 </script>
120
121 <button id="button2">Click Me</button>
122
123 <script>
124 test(function(t) {
125 var button = document.getElementById("button2");
126 var aomButton = button.accessibleNode;
127 var axButton = accessibilityController.accessibleElementById("button2");
128
129 button.setAttribute("role", "textbox");
130 button.setAttribute("aria-label", "ARIA");
131 assert_equals(axButton.role, "AXRole: AXTextField");
132 assert_equals(axButton.name, "ARIA");
133
134 aomButton.role = "radio";
135 aomButton.label = "AOM";
136 assert_equals(axButton.role, "AXRole: AXRadioButton");
137 assert_equals(axButton.name, "AOM");
138 }, "Test that AOM properties override ARIA attributes");
139 </script>
140
141 <button id="button3">Click Me</button>
142
143 <script>
144 test(function(t) {
145 var button = document.getElementById("button3");
146 var aomButton = button.accessibleNode;
147 var axButton = accessibilityController.accessibleElementById("button3");
148 assert_equals(axButton.role, "AXRole: AXButton");
149 assert_equals(axButton.name, "Click Me");
150
151 button.setAttribute("role", "textbox");
152 button.setAttribute("aria-label", "ARIA");
153 assert_equals(axButton.role, "AXRole: AXTextField");
154 assert_equals(axButton.name, "ARIA");
155
156 aomButton.role = "radio";
157 aomButton.label = "AOM";
158 assert_equals(axButton.role, "AXRole: AXRadioButton");
159 assert_equals(axButton.name, "AOM");
160
161 aomButton.role = null;
162 aomButton.label = null;
163 assert_equals(axButton.role, "AXRole: AXButton");
164 assert_equals(axButton.name, "Click Me");
165
166 button.setAttribute("role", "combobox");
167 button.setAttribute("aria-label", "ARIA 2");
168 assert_equals(axButton.role, "AXRole: AXButton");
169 assert_equals(axButton.name, "Click Me");
170 }, "Once an AOM property has been set, ARIA no longer has any effect");
171 </script>
172
173 <button id="button4">Click Me</button>
174
175 <script>
176 test(function(t) {
177 var aomButton;
178 (function() {
179 var button = document.getElementById("button4");
180 button.setAttribute("role", "checkbox");
181 button.setAttribute("aria-label", "Check Me");
182 aomButton = button.accessibleNode;
183 })();
184 assert_equals(aomButton.role, "checkbox");
185 assert_equals(aomButton.label, "Check Me");
186
187 (function() {
188 var button = document.getElementById("button4");
189 button.parentElement.removeChild(button);
190 })();
191 gc();
192
193 assert_equals(aomButton.role, "checkbox");
194 assert_equals(aomButton.label, "Check Me");
195 }, "An AccessibleNode keeps its element alive.");
196 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698