Chromium Code Reviews| 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: 0, start: 0, end: 0}, |
|
Peter Lundblad
2015/09/29 09:27:34
Where does this span of the number 0 come from and
dmazzoni
2015/10/01 20:41:43
Oops, I thought that was because I got rid of the
| |
| 114 {value: 'role', start: 1, end: 10}, | 117 {value: 'name', start: 1, end: 1}, |
| 115 {value: 'state', start: 11, end: 22}, | 118 {value: 'role', start: 2, end: 11}, |
| 116 | 119 {value: 'state', start: 12, end: 23} |
| 117 // Checkbox earcon (based on the state). | |
| 118 {value: {earconId: 'CHECK_OFF'}, start: 11, end: 22} | |
| 119 ]}, o.speechOutputForTest); | 120 ]}, o.speechOutputForTest); |
| 120 checkBrailleOutput( | 121 checkBrailleOutput( |
| 121 'chk ( )', | 122 'chk ( )', |
| 122 [{value: new Output.NodeSpan(el), start: 0, end: 7}], | 123 [{value: new Output.NodeSpan(el), start: 0, end: 7}], |
| 123 o); | 124 o); |
| 124 }); | 125 }); |
| 125 }); | 126 }); |
| 126 | 127 |
| 127 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { | 128 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { |
| 128 this.runWithLoadedTree('<p>OK', | 129 this.runWithLoadedTree('<p>OK', |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 checkBrailleOutput( | 217 checkBrailleOutput( |
| 217 'audio tlbar play begin playback btn', | 218 'audio tlbar play begin playback btn', |
| 218 [{value: new Output.NodeSpan(el.parent), start: 0, end: 11}, | 219 [{value: new Output.NodeSpan(el.parent), start: 0, end: 11}, |
| 219 {value: new Output.NodeSpan(el), start: 12, end: 35}], | 220 {value: new Output.NodeSpan(el), start: 12, end: 35}], |
| 220 o); | 221 o); |
| 221 | 222 |
| 222 el = el.nextSibling; | 223 el = el.nextSibling; |
| 223 var prevRange = range; | 224 var prevRange = range; |
| 224 range = cursors.Range.fromNode(el); | 225 range = cursors.Range.fromNode(el); |
| 225 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate'); | 226 var o = new Output().withSpeechAndBraille(range, prevRange, 'navigate'); |
| 226 assertEqualsJSON({string_: '0, , slider|audio time scrubber', | 227 assertEqualsJSON({string_: '|0, , slider|audio time scrubber', |
| 227 spans_: | 228 spans_: |
| 228 [{value: 'help', start: 12, end: 31}] | 229 [{value: {'earconId': 'SLIDER'}, start: 0, end: 0}, |
| 230 {value: 0, start: 0, end: 0}, | |
|
Peter Lundblad
2015/09/29 09:27:34
Where does 0 come from?
dmazzoni
2015/10/01 20:41:43
Same bug as above. Fixed.
| |
| 231 {value: 'help', start: 13, end: 32}] | |
| 229 }, o.speechOutputForTest); | 232 }, o.speechOutputForTest); |
| 230 // TODO(plundblad): Investigate this. | 233 // TODO(plundblad): Investigate this. |
| 231 checkBrailleOutput( | 234 checkBrailleOutput( |
| 232 '0, , slider audio time scrubber', | 235 '0, , slider audio time scrubber', |
| 233 [{value: new Output.NodeSpan(el), start: 0, end: 31}], | 236 [{value: new Output.NodeSpan(el), start: 0, end: 31}], |
| 234 o); | 237 o); |
| 235 }); | 238 }); |
| 236 }); | 239 }); |
| 237 | 240 |
| 238 TEST_F('OutputE2ETest', 'Input', function() { | 241 TEST_F('OutputE2ETest', 'Input', function() { |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 <div role="menuitem">a</div> | 449 <div role="menuitem">a</div> |
| 447 </div> | 450 </div> |
| 448 */}, | 451 */}, |
| 449 function(root) { | 452 function(root) { |
| 450 var el = root.firstChild.firstChild; | 453 var el = root.firstChild.firstChild; |
| 451 var range = cursors.Range.fromNode(el); | 454 var range = cursors.Range.fromNode(el); |
| 452 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 455 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 453 assertEqualsJSON({string_: | 456 assertEqualsJSON({string_: |
| 454 '|Menu|with 1 item|a|Menu item| 1 of 1 ', spans_: [ | 457 '|Menu|with 1 item|a|Menu item| 1 of 1 ', spans_: [ |
| 455 {value: 'name', start: 18, end: 19}, | 458 {value: 'name', start: 18, end: 19}, |
| 459 {value: {earconId: 'BUTTON'}, start:18, end:19}, | |
| 456 {value: 'role', start:20, end: 29} | 460 {value: 'role', start:20, end: 29} |
| 457 ]}, o.speechOutputForTest); | 461 ]}, o.speechOutputForTest); |
| 458 checkBrailleOutput( | 462 checkBrailleOutput( |
| 459 'mnu +1 a mnuitm 1/1', | 463 'mnu +1 a mnuitm 1/1', |
| 460 [{value: new Output.NodeSpan(el.parent), start: 0, end: 6}, | 464 [{value: new Output.NodeSpan(el.parent), start: 0, end: 6}, |
| 461 {value: new Output.NodeSpan(el), start: 7, end: 19}], | 465 {value: new Output.NodeSpan(el), start: 7, end: 19}], |
| 462 o); | 466 o); |
| 463 }); | 467 }); |
| 464 }); | 468 }); |
| 465 | 469 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 assertEqualsJSON({string_: '|that has content', | 540 assertEqualsJSON({string_: '|that has content', |
| 537 spans_: [ | 541 spans_: [ |
| 538 {value: 'name', start: 1, end: 17} | 542 {value: 'name', start: 1, end: 17} |
| 539 ]}, o.speechOutputForTest); | 543 ]}, o.speechOutputForTest); |
| 540 checkBrailleOutput( | 544 checkBrailleOutput( |
| 541 'that has content', | 545 'that has content', |
| 542 [{value: new Output.NodeSpan(el), start: 0, end: 16}], | 546 [{value: new Output.NodeSpan(el), start: 0, end: 16}], |
| 543 o); | 547 o); |
| 544 }); | 548 }); |
| 545 }); | 549 }); |
| OLD | NEW |