Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 <script> | |
| 15 if (window.internals) | |
| 16 internals.runtimeFlags.accessibilityObjectModelEnabled = true; | |
| 17 </script> | |
| 18 | |
| 19 <div role="combobox" id="autocomplete"></div> | |
| 20 | |
| 21 <script> | |
| 22 test(function(t) { | |
| 23 var node = document.getElementById("autocomplete"); | |
| 24 var axNode = accessibilityController.accessibleElementById("autocomplete"); | |
| 25 assert_equals(axNode.autocomplete, ""); | |
|
aboxhall
2017/03/31 00:23:38
Is this equivalent to "none"? Per https://www.w3.o
dmazzoni
2017/03/31 04:34:57
Yes, if we had an enum this would be the same as "
| |
| 26 node.accessibleNode.autocomplete = "inline"; | |
| 27 assert_equals(axNode.autocomplete, "inline"); | |
| 28 }, "AccessibleNode.autocomplete"); | |
| 29 </script> | |
| 30 | |
| 31 <div role="checkbox" id="checked"></div> | |
| 32 | |
| 33 <script> | |
| 34 test(function(t) { | |
| 35 var node = document.getElementById("checked"); | |
| 36 var axNode = accessibilityController.accessibleElementById("checked"); | |
| 37 assert_equals(axNode.isChecked, false); | |
| 38 node.accessibleNode.checked = "true"; | |
|
aboxhall
2017/03/31 00:23:38
Do we want to enable using boolean true/false as a
dmazzoni
2017/03/31 04:34:58
Hmmm, not sure I like that since this is actually
aboxhall
2017/03/31 04:41:54
Yeah, I realise it's a tristate, but "mixed" is so
| |
| 39 assert_equals(axNode.isChecked, true); | |
| 40 node.accessibleNode.checked = "mixed"; | |
| 41 assert_equals(axNode.isChecked, false); | |
| 42 assert_equals(axNode.isButtonStateMixed, true); | |
| 43 }, "AccessibleNode.checked"); | |
| 44 </script> | |
| 45 | |
| 46 <div role="tab" id="current"></div> | |
| 47 | |
| 48 <script> | |
| 49 test(function(t) { | |
| 50 var node = document.getElementById("current"); | |
| 51 var axNode = accessibilityController.accessibleElementById("current"); | |
| 52 assert_equals(axNode.current, ""); | |
| 53 node.accessibleNode.current = "page"; | |
| 54 assert_equals(axNode.current, "page"); | |
| 55 }, "AccessibleNode.current"); | |
| 56 </script> | |
| 57 | |
| 58 <div role="textbox" id="invalid"></div> | |
| 59 | |
| 60 <script> | |
| 61 test(function(t) { | |
| 62 var node = document.getElementById("invalid"); | |
| 63 var axNode = accessibilityController.accessibleElementById("invalid"); | |
| 64 assert_equals(axNode.invalid, ""); | |
| 65 node.accessibleNode.invalid = "spelling"; | |
| 66 assert_equals(axNode.invalid, "spelling"); | |
| 67 }, "AccessibleNode.invalid"); | |
| 68 </script> | |
| 69 | |
| 70 <div role="button" id="keyShortcuts"></div> | |
| 71 | |
| 72 <script> | |
| 73 test(function(t) { | |
| 74 var node = document.getElementById("keyShortcuts"); | |
| 75 var axNode = accessibilityController.accessibleElementById("keyShortcuts"); | |
| 76 assert_equals(axNode.keyShortcuts, ""); | |
| 77 node.accessibleNode.keyShortcuts = "Ctrl+F"; | |
| 78 assert_equals(axNode.keyShortcuts, "Ctrl+F"); | |
| 79 }, "AccessibleNode.keyShortcuts"); | |
| 80 </script> | |
| 81 | |
| 82 <div role="heading" id="label">Inner text</div> | |
| 83 | |
| 84 <script> | |
| 85 test(function(t) { | |
| 86 var node = document.getElementById("label"); | |
| 87 var axNode = accessibilityController.accessibleElementById("label"); | |
| 88 assert_equals(axNode.name, "Inner text"); | |
| 89 node.accessibleNode.label = "Label"; | |
| 90 assert_equals(axNode.name, "Label"); | |
| 91 }, "AccessibleNode.label"); | |
| 92 </script> | |
| 93 | |
| 94 <div role="banner" id="live"></div> | |
| 95 | |
| 96 <script> | |
| 97 test(function(t) { | |
| 98 var node = document.getElementById("live"); | |
| 99 var axNode = accessibilityController.accessibleElementById("live"); | |
| 100 assert_equals(axNode.live, ""); | |
| 101 node.accessibleNode.live = "polite"; | |
| 102 assert_equals(axNode.live, "polite"); | |
| 103 }, "AccessibleNode.live"); | |
| 104 </script> | |
| 105 | |
| 106 <div role="slider" id="orientation"></div> | |
| 107 | |
| 108 <script> | |
| 109 test(function(t) { | |
| 110 var node = document.getElementById("orientation"); | |
| 111 var axNode = accessibilityController.accessibleElementById("orientation"); | |
| 112 assert_equals(axNode.orientation, "AXOrientation: AXHorizontalOrientation"); | |
| 113 node.accessibleNode.orientation = "vertical"; | |
| 114 assert_equals(axNode.orientation, "AXOrientation: AXVerticalOrientation"); | |
| 115 }, "AccessibleNode.orientation"); | |
| 116 </script> | |
| 117 | |
| 118 <input id="placeholder"> | |
| 119 | |
| 120 <script> | |
| 121 test(function(t) { | |
| 122 var node = document.getElementById("placeholder"); | |
| 123 var axNode = accessibilityController.accessibleElementById("placeholder"); | |
| 124 assert_equals(axNode.name, ""); | |
| 125 node.accessibleNode.placeholder = "Placeholder"; | |
| 126 assert_equals(axNode.name, "Placeholder"); | |
|
aboxhall
2017/03/31 00:23:39
Why not check axNode.placeholder directly here (as
dmazzoni
2017/03/31 04:34:57
We actually don't return anything from "placeholde
aboxhall
2017/04/03 23:20:24
Oh nice :)
| |
| 127 }, "AccessibleNode.placeholder"); | |
| 128 </script> | |
| 129 | |
| 130 <div role="banner" id="relevant"></div> | |
| 131 | |
| 132 <script> | |
| 133 test(function(t) { | |
| 134 var node = document.getElementById("relevant"); | |
| 135 var axNode = accessibilityController.accessibleElementById("relevant"); | |
| 136 assert_equals(axNode.relevant, "additions text"); | |
| 137 node.accessibleNode.relevant = "additions"; | |
| 138 assert_equals(axNode.relevant, "additions"); | |
| 139 }, "AccessibleNode.relevant"); | |
| 140 </script> | |
| 141 | |
| 142 <div role="button" id="role"></div> | |
| 143 | |
| 144 <script> | |
| 145 test(function(t) { | |
| 146 var node = document.getElementById("role"); | |
| 147 var axNode = accessibilityController.accessibleElementById("role"); | |
| 148 assert_equals(axNode.role, "AXRole: AXButton"); | |
| 149 node.accessibleNode.role = "combobox"; | |
|
aboxhall
2017/03/31 00:23:38
Test role fallback as well, i.e. node.accessibleNo
dmazzoni
2017/03/31 04:34:57
Done.
| |
| 150 assert_equals(axNode.role, "AXRole: AXComboBox"); | |
| 151 }, "AccessibleNode.role"); | |
| 152 </script> | |
| 153 | |
| 154 <div role="button" id="roleDescription"></div> | |
| 155 | |
| 156 <script> | |
| 157 test(function(t) { | |
| 158 var node = document.getElementById("roleDescription"); | |
| 159 var axNode = accessibilityController.accessibleElementById("roleDescription" ); | |
| 160 assert_equals(axNode.roleDescription, ""); | |
| 161 node.accessibleNode.roleDescription = "Push Button"; | |
| 162 assert_equals(axNode.roleDescription, "Push Button"); | |
| 163 }, "AccessibleNode.roleDescription"); | |
| 164 </script> | |
| 165 | |
| 166 <div role="columnheader" id="sort"></div> | |
| 167 | |
| 168 <script> | |
| 169 test(function(t) { | |
| 170 var node = document.getElementById("sort"); | |
| 171 var axNode = accessibilityController.accessibleElementById("sort"); | |
| 172 assert_equals(axNode.sort, ""); | |
|
aboxhall
2017/03/31 00:23:39
Similarly, should this be explicitly "none"? Maybe
dmazzoni
2017/03/31 04:34:57
Yeah, this is just supposed to match what we retur
| |
| 173 node.accessibleNode.sort = "ascending"; | |
| 174 assert_equals(axNode.sort, "ascending"); | |
| 175 }, "AccessibleNode.sort"); | |
| 176 </script> | |
| 177 | |
| 178 <div role="slider" id="valueText" aria-valuetext="5"></div> | |
| 179 | |
| 180 <script> | |
| 181 test(function(t) { | |
| 182 var node = document.getElementById("valueText"); | |
| 183 var axNode = accessibilityController.accessibleElementById("valueText"); | |
| 184 assert_equals(axNode.valueDescription, "AXValueDescription: 5"); | |
| 185 node.accessibleNode.valueText = "Five"; | |
| 186 assert_equals(axNode.valueDescription, "AXValueDescription: Five"); | |
| 187 }, "AccessibleNode.valueText"); | |
| 188 </script> | |
| OLD | NEW |