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

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/input-mixed.html

Issue 2707263011: Test aria-pressed=mixed on windows (Closed)
Patch Set: git cl try Created 3 years, 6 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
OLDNEW
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 <!-- Will set indeterminate state via JS --> 4 <!-- Will set indeterminate state via JS -->
5 <input id="element1" type="checkbox" /> 5 <input id="element1" type="checkbox" />
6 <script> 6 <script>
7 // No way currently to do this via markup, must be via JS 7 // No way currently to do this via markup, must be via JS
8 document.getElementById('element1').indeterminate = true; 8 document.getElementById("element1").indeterminate = true;
9 </script> 9 </script>
10 <!-- Control--> 10 <!-- Control-->
11 <input id="element2" type="checkbox" /> 11 <input id="element2" type="checkbox" />
12 12
13 <div> 13 <div>
14 <!-- Will be ::indeterminate in CSS because no radio item selected yet --> 14 <!-- Will be ::indeterminate in CSS because no radio item selected yet -->
15 <input type="radio" name="radiogroup1" /> 15 <input type="radio" name="radiogroup1" />
16 <input id="element3" type="radio" name="radiogroup1" /> 16 <input id="element3" type="radio" name="radiogroup1" />
17 </div> 17 </div>
18 18
19 <div> 19 <div>
20 <!-- NOT mixed/indeterminate because group has a selected radio button --> 20 <!-- NOT mixed/indeterminate because group has a selected radio button -->
21 <input id="element4" type="radio" name="radiogroup2" /> 21 <input id="element4" type="radio" name="radiogroup2" />
22 <input id="element5" type="radio" checked name="radiogroup2" /> 22 <input id="element5" type="radio" checked name="radiogroup2" />
23 </div> 23 </div>
24 24
25 <input id="input-button" type="button"/>
26 <input id="input-button-false" type="button" aria-pressed="false"/>
27 <input id="input-button-mixed" type="button" aria-pressed="mixed"/>
28 <input id="input-button-true" type="button" aria-pressed="true"/>
29 <div id="aria-button" role="button">button</div>
30 <div id="aria-button-false" role="button" aria-pressed="false">button</div>
31 <div id="aria-button-mixed" role="button" aria-pressed="mixed">button</div>
32 <div id="aria-button-true" role="button" aria-pressed="true">button</div>
33 <button id="button">button</button>
34 <button id="button-false" aria-pressed="false">button</button>
35 <button id="button-mixed" aria-pressed="mixed">button</button>
36 <button id="button-true" aria-pressed="true">button</button>
37
25 <script> 38 <script>
26 39
27 function axElementById(id) { 40 function axElementById(id) {
28 return accessibilityController.accessibleElementById(id); 41 return accessibilityController.accessibleElementById(id);
29 } 42 }
30 43
31 test(function(t) { 44 test(function(t) {
32 var ax = axElementById("element1"); 45 var ax = axElementById("element1");
33 assert_true(ax.isButtonStateMixed); 46 assert_true(ax.checkedState === "mixed");
34 }, "A native indeterminate checkbox must have the mixed state"); 47 }, "A native indeterminate checkbox must have the mixed state");
35 48
36 test(function(t) { 49 test(function(t) {
37 var ax = axElementById("element2"); 50 var ax = axElementById("element2");
38 assert_false(ax.isButtonStateMixed); 51 assert_false(ax.checkedState === "mixed");
39 }, "A native checkbox that is not indeterminate" + 52 }, "A native checkbox that is not indeterminate" +
40 " must NOT have the mixed state"); 53 " must NOT have the mixed state");
41 54
42 test(function(t) { 55 test(function(t) {
43 var ax = axElementById("element3"); 56 var ax = axElementById("element3");
44 assert_true(ax.isButtonStateMixed); 57 assert_true(ax.checkedState === "mixed");
45 }, "A native radio that in a group with nothing checked" + 58 }, "A native radio that in a group with nothing checked" +
46 " must have the mixed state"); 59 " must have the mixed state");
47 60
48 test(function(t) { 61 test(function(t) {
49 var ax = axElementById("element4"); 62 var ax = axElementById("element4");
50 assert_false(ax.isButtonStateMixed); 63 assert_false(ax.checkedState === "mixed");
51 }, "A native radio that in a group with something checked" + 64 }, "A native radio that in a group with something checked" +
52 " must NOT have the mixed state"); 65 " must NOT have the mixed state");
53 66
54 test(function(t) { 67 test(function(t) {
55 var ax = axElementById("element4"); 68 var ax = axElementById("input-button");
56 assert_false(ax.isButtonStateMixed); 69 assert_equals(ax.pressedState, "false");
57 }, "A checked native radio must NOT have the mixed state"); 70 }, "<input type=button> is not pressed");
71
72 test(function(t) {
73 var ax = axElementById("input-button-false");
74 assert_equals(ax.pressedState, "false");
75 }, "<input type=button aria-pressed=false> is not pressed");
76
77 test(function(t) {
78 var ax = axElementById("input-button-false");
79 assert_equals(ax.role, "AXRole: AXToggleButton");
80 }, "<input type=button aria-pressed=false> is a toggle button");
81
82 test(function(t) {
83 var ax = axElementById("input-button-mixed");
84 assert_equals(ax.pressedState, "mixed");
85 }, "<input type=button aria-pressed=mixed> has pressed state of mixed");
86
87 test(function(t) {
88 var ax = axElementById("input-button-mixed");
89 assert_equals(ax.role, "AXRole: AXToggleButton");
90 }, "<input type=button aria-pressed=mixed> is a toggle button");
91
92 test(function(t) {
93 var ax = axElementById("input-button-true");
94 assert_equals(ax.pressedState, "true");
95 }, "<input type=button aria-pressed=true> has pressed state of true");
96
97 test(function(t) {
98 var ax = axElementById("input-button-true");
99 assert_equals(ax.role, "AXRole: AXToggleButton");
100 }, "<input type=button aria-pressed=true> is a toggle button");
101
102 test(function(t) {
103 var ax = axElementById("aria-button");
104 assert_equals(ax.pressedState, "false");
105 }, "<div role=button> is not pressed");
106
107 test(function(t) {
108 var ax = axElementById("aria-button-false");
109 assert_equals(ax.pressedState, "false");
110 }, "<div role=button aria-pressed=false> is not pressed");
111
112 test(function(t) {
113 var ax = axElementById("aria-button-false");
114 assert_equals(ax.role, "AXRole: AXToggleButton");
115 }, "<div role=button aria-pressed=false> is a toggle button");
116
117 test(function(t) {
118 var ax = axElementById("aria-button-mixed");
119 assert_equals(ax.pressedState, "mixed");
120 }, "<div role=button aria-pressed=mixed> has pressed state of mixed");
121
122 test(function(t) {
123 var ax = axElementById("aria-button-mixed");
124 assert_equals(ax.role, "AXRole: AXToggleButton");
125 }, "<div role=button aria-pressed=mixed> is a toggle button");
126
127 test(function(t) {
128 var ax = axElementById("aria-button-true");
129 assert_equals(ax.pressedState, "true");
130 }, "<div role=button aria-pressed=true> has pressed state of true");
131
132 test(function(t) {
133 var ax = axElementById("aria-button-true");
134 assert_equals(ax.role, "AXRole: AXToggleButton");
135 }, "<div role=button aria-pressed=true> is a toggle button");
136
137 test(function(t) {
138 var ax = axElementById("button");
139 assert_equals(ax.pressedState, "false");
140 }, "<button> is not pressed");
141
142 test(function(t) {
143 var ax = axElementById("button-false");
144 assert_equals(ax.pressedState, "false");
145 }, "<button aria-pressed=false> is not pressed");
146
147 test(function(t) {
148 var ax = axElementById("button-false");
149 assert_equals(ax.role, "AXRole: AXToggleButton");
150 }, "<button aria-pressed=false> is a toggle button");
151
152 test(function(t) {
153 var ax = axElementById("button-mixed");
154 assert_equals(ax.pressedState, "mixed");
155 }, "<button aria-pressed=mixed> has pressed state of mixed");
156
157 test(function(t) {
158 var ax = axElementById("button-mixed");
159 assert_equals(ax.role, "AXRole: AXToggleButton");
160 }, "<button aria-pressed=mixed> is a toggle button");
161
162 test(function(t) {
163 var ax = axElementById("button-true");
164 assert_equals(ax.pressedState, "true");
165 }, "<button aria-pressed=true> has pressed state of true");
166
167 test(function(t) {
168 var ax = axElementById("button-true");
169 assert_equals(ax.role, "AXRole: AXToggleButton");
170 }, "<button aria-pressed=true> is a toggle button");
171
58 </script> 172 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698