OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 GEN_INCLUDE(['../../testing/assert_additions.js']); | 5 GEN_INCLUDE(['../../testing/assert_additions.js']); |
6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); | 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); |
7 | 7 |
8 /** | 8 /** |
9 * Gets the braille output and asserts that it matches expected values. | 9 * Gets the braille output and asserts that it matches expected values. |
10 * Annotations in the output that are primitive strings are ignored. | 10 * Annotations in the output that are primitive strings are ignored. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 o); | 101 o); |
102 }); | 102 }); |
103 }); | 103 }); |
104 | 104 |
105 TEST_F('OutputE2ETest', 'Checkbox', function() { | 105 TEST_F('OutputE2ETest', 'Checkbox', function() { |
106 this.runWithLoadedTree('<input type="checkbox">', | 106 this.runWithLoadedTree('<input type="checkbox">', |
107 function(root) { | 107 function(root) { |
108 var el = root.firstChild.firstChild; | 108 var el = root.firstChild.firstChild; |
109 var range = cursors.Range.fromNode(el); | 109 var range = cursors.Range.fromNode(el); |
110 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 110 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
111 assertEqualsJSON({string_: '|Check box|not checked', 'spans_': [ | 111 assertEqualsJSON({string_: '||Check box|not checked', 'spans_': [ |
| 112 // Checkbox earcon (based on the state). |
| 113 {value: {earconId: 'CHECK_OFF'}, start: 0, end: 0}, |
| 114 |
112 // Attributes. | 115 // Attributes. |
113 {value: 'name', start: 0, end: 0}, | 116 {value: 'name', start: 1, end: 1}, |
114 {value: 'role', start: 1, end: 10}, | 117 {value: 'role', start: 2, end: 11}, |
115 {value: 'state', start: 11, end: 22}, | 118 {value: 'state', start: 12, end: 23} |
116 | |
117 // Checkbox earcon (based on the state). | |
118 {value: {earconId: 'CHECK_OFF'}, start: 11, end: 22} | |
119 ]}, o.speechOutputForTest); | 119 ]}, o.speechOutputForTest); |
120 checkBrailleOutput( | 120 checkBrailleOutput( |
121 'chk ( )', | 121 'chk ( )', |
122 [{value: new Output.NodeSpan(el), start: 0, end: 7}], | 122 [{value: new Output.NodeSpan(el), start: 0, end: 7}], |
123 o); | 123 o); |
124 }); | 124 }); |
125 }); | 125 }); |
126 | 126 |
127 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { | 127 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { |
128 this.runWithLoadedTree('<p>OK', | 128 this.runWithLoadedTree('<p>OK', |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 checkBrailleOutput( | 216 checkBrailleOutput( |
217 'audio tlbar play begin playback btn', | 217 'audio tlbar play begin playback btn', |
218 [{value: new Output.NodeSpan(el.parent), start: 0, end: 11}, | 218 [{value: new Output.NodeSpan(el.parent), start: 0, end: 11}, |
219 {value: new Output.NodeSpan(el), start: 12, end: 35}], | 219 {value: new Output.NodeSpan(el), start: 12, end: 35}], |
220 o); | 220 o); |
221 | 221 |
222 el = el.nextSibling; | 222 el = el.nextSibling; |
223 var prevRange = range; | 223 var prevRange = range; |
224 range = cursors.Range.fromNode(el); | 224 range = cursors.Range.fromNode(el); |
225 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate'); | 225 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate'); |
226 assertEqualsJSON({string_: '0, , slider|audio time scrubber', | 226 assertEqualsJSON({string_: '|0, , slider|audio time scrubber', |
227 spans_: | 227 spans_: |
228 [{value: 'help', start: 12, end: 31}] | 228 [{value: {'earconId': 'SLIDER'}, start: 0, end: 0}, |
| 229 {value: 'help', start: 13, end: 32}] |
229 }, o.speechOutputForTest); | 230 }, o.speechOutputForTest); |
230 // TODO(plundblad): Investigate this. | 231 // TODO(plundblad): Investigate this. |
231 checkBrailleOutput( | 232 checkBrailleOutput( |
232 '0, , slider audio time scrubber', | 233 '0, , slider audio time scrubber', |
233 [{value: new Output.NodeSpan(el), start: 0, end: 31}], | 234 [{value: new Output.NodeSpan(el), start: 0, end: 31}], |
234 o); | 235 o); |
235 }); | 236 }); |
236 }); | 237 }); |
237 | 238 |
238 TEST_F('OutputE2ETest', 'Input', function() { | 239 TEST_F('OutputE2ETest', 'Input', function() { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 <div role="menuitem">a</div> | 447 <div role="menuitem">a</div> |
447 </div> | 448 </div> |
448 */}, | 449 */}, |
449 function(root) { | 450 function(root) { |
450 var el = root.firstChild.firstChild; | 451 var el = root.firstChild.firstChild; |
451 var range = cursors.Range.fromNode(el); | 452 var range = cursors.Range.fromNode(el); |
452 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 453 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
453 assertEqualsJSON({string_: | 454 assertEqualsJSON({string_: |
454 '|Menu|with 1 item|a|Menu item| 1 of 1 ', spans_: [ | 455 '|Menu|with 1 item|a|Menu item| 1 of 1 ', spans_: [ |
455 {value: 'name', start: 18, end: 19}, | 456 {value: 'name', start: 18, end: 19}, |
| 457 {value: {earconId: 'BUTTON'}, start:18, end:19}, |
456 {value: 'role', start:20, end: 29} | 458 {value: 'role', start:20, end: 29} |
457 ]}, o.speechOutputForTest); | 459 ]}, o.speechOutputForTest); |
458 checkBrailleOutput( | 460 checkBrailleOutput( |
459 'mnu +1 a mnuitm 1/1', | 461 'mnu +1 a mnuitm 1/1', |
460 [{value: new Output.NodeSpan(el.parent), start: 0, end: 6}, | 462 [{value: new Output.NodeSpan(el.parent), start: 0, end: 6}, |
461 {value: new Output.NodeSpan(el), start: 7, end: 19}], | 463 {value: new Output.NodeSpan(el), start: 7, end: 19}], |
462 o); | 464 o); |
463 }); | 465 }); |
464 }); | 466 }); |
465 | 467 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 assertEqualsJSON({string_: '|that has content', | 538 assertEqualsJSON({string_: '|that has content', |
537 spans_: [ | 539 spans_: [ |
538 {value: 'name', start: 1, end: 17} | 540 {value: 'name', start: 1, end: 17} |
539 ]}, o.speechOutputForTest); | 541 ]}, o.speechOutputForTest); |
540 checkBrailleOutput( | 542 checkBrailleOutput( |
541 'that has content', | 543 'that has content', |
542 [{value: new Output.NodeSpan(el), start: 0, end: 16}], | 544 [{value: new Output.NodeSpan(el), start: 0, end: 16}], |
543 o); | 545 o); |
544 }); | 546 }); |
545 }); | 547 }); |
OLD | NEW |