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

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

Issue 2823053002: Test for anything falsey as a fail value for element.accessibleNode. Test for anything truthy as a … (Closed)
Patch Set: Slightly cleaner assertion syntax 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <script src="../resources/gc.js"></script> 2 <script src="../resources/gc.js"></script>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 5
6 <!-- 6 <!--
7 7
8 Accessibility Object Model 8 Accessibility Object Model
9 Explainer: https://github.com/WICG/aom/blob/master/explainer.md 9 Explainer: https://github.com/WICG/aom/blob/master/explainer.md
10 Spec: https://wicg.github.io/aom/spec/ 10 Spec: https://wicg.github.io/aom/spec/
11 11
12 --> 12 -->
13 13
14 <button id="button">Click Me</button> 14 <button id="button">Click Me</button>
15 15
16 <script> 16 <script>
17 if (window.internals) 17 if (window.internals)
18 internals.runtimeFlags.accessibilityObjectModelEnabled = true; 18 internals.runtimeFlags.accessibilityObjectModelEnabled = true;
19 19
20 test(function(t) { 20 test(function(t) {
21 var button = document.getElementById("button"); 21 var button = document.getElementById("button");
22 assert_equals(button.nodeType, Node.ELEMENT_NODE); 22 assert_equals(button.nodeType, Node.ELEMENT_NODE);
23 assert_not_equals(button.accessibleNode, null); 23 assert_true(Boolean(button.accessibleNode));
24 }, "DOM Elements have an AccessibleNode"); 24 }, "DOM Elements have an AccessibleNode");
aleventhal 2017/04/17 20:58:19 This was passing when it shouldn't, because access
25 25
26 test(function(t) { 26 test(function(t) {
27 var button = document.getElementById("button"); 27 var button = document.getElementById("button");
28 var staticText = button.firstChild; 28 var staticText = button.firstChild;
29 assert_equals(staticText.nodeType, Node.TEXT_NODE); 29 assert_equals(staticText.nodeType, Node.TEXT_NODE);
30 assert_not_equals(staticText.accessibleNode, null); 30 assert_false(Boolean(staticText.accessibleNode));
31 }, "DOM Text nodes do not have an AccessibleNode."); 31 }, "DOM Text nodes do not have an AccessibleNode.");
aleventhal 2017/04/17 20:58:19 The description of this test is opposite from what
32 32
33 test(function(t) { 33 test(function(t) {
34 var button = document.getElementById("button"); 34 var button = document.getElementById("button");
35 var aomButton = button.accessibleNode; 35 var aomButton = button.accessibleNode;
36 36
37 assert_equals(aomButton.role, null); 37 assert_equals(aomButton.role, null);
38 assert_equals(aomButton.label, null); 38 assert_equals(aomButton.label, null);
39 assert_equals(aomButton.foo, undefined); 39 assert_equals(aomButton.foo, undefined);
40 assert_equals(aomButton.bar, undefined); 40 assert_equals(aomButton.bar, undefined);
41 }, "Supported properties on an AccessibleNode are all null by default"); 41 }, "Supported properties on an AccessibleNode are all null by default");
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 (function() { 187 (function() {
188 var button = document.getElementById("button4"); 188 var button = document.getElementById("button4");
189 button.parentElement.removeChild(button); 189 button.parentElement.removeChild(button);
190 })(); 190 })();
191 gc(); 191 gc();
192 192
193 assert_equals(aomButton.role, "checkbox"); 193 assert_equals(aomButton.role, "checkbox");
194 assert_equals(aomButton.label, "Check Me"); 194 assert_equals(aomButton.label, "Check Me");
195 }, "An AccessibleNode keeps its element alive."); 195 }, "An AccessibleNode keeps its element alive.");
196 </script> 196 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698