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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 end: expectedValue.string_.length}], | 347 end: expectedValue.string_.length}], |
| 348 o); | 348 o); |
| 349 } | 349 } |
| 350 el = el.nextSibling; | 350 el = el.nextSibling; |
| 351 }); | 351 }); |
| 352 }); | 352 }); |
| 353 }); | 353 }); |
| 354 | 354 |
| 355 TEST_F('OutputE2ETest', 'List', function() { | 355 TEST_F('OutputE2ETest', 'List', function() { |
| 356 this.runWithLoadedTree( | 356 this.runWithLoadedTree( |
| 357 '<ul><li>a<li>b<li>c</ul>', | 357 '<ul><li aria-label="a">a<li>b<li>c</ul>', |
| 358 function(root) { | 358 function(root) { |
| 359 var el = root.firstChild.firstChild; | 359 var el = root.firstChild.firstChild; |
| 360 var range = cursors.Range.fromNode(el); | 360 var range = cursors.Range.fromNode(el); |
| 361 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 361 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 362 checkSpeechOutput('a|List item|list|with 3 items', | 362 checkSpeechOutput('a|List item|list|with 3 items', |
| 363 [ | 363 [ |
| 364 {value: 'name', start: 0, end: 1}, | 364 { value: 'nameOrDescendants', start: 0, end: 1 }, |
| 365 {value: new Output.EarconAction('LIST_ITEM'), start: 0, end: 1}, | 365 { value: 'role', start: 12, end: 16 } |
|
David Tseng
2017/05/17 18:20:46
What happened to the earcon?
| |
| 366 {value: 'role', start: 12, end: 16} | |
| 367 ], | 366 ], |
| 368 o); | 367 o); |
| 369 // TODO(plundblad): This output is wrong. Add special handling for | 368 // TODO(plundblad): This output is wrong. Add special handling for |
| 370 // braille here. | 369 // braille here. |
| 371 checkBrailleOutput( | 370 checkBrailleOutput( |
| 372 'a lstitm list +3', | 371 'a lstitm list +3', |
| 373 [{value: new Output.NodeSpan(el), start: 0, end: 8}, | 372 [ |
| 374 {value: new Output.NodeSpan(el.parent), start: 9, end: 16}], | 373 {value: new Output.NodeSpan(el), start: 0, end: 8}, |
| 374 {value: new Output.NodeSpan(el.parent), start: 9, end: 16} | |
| 375 ], | |
| 375 o); | 376 o); |
| 376 }); | 377 }); |
| 377 }); | 378 }); |
| 378 | 379 |
| 379 TEST_F('OutputE2ETest', 'Tree', function() { | 380 TEST_F('OutputE2ETest', 'Tree', function() { |
| 380 this.runWithLoadedTree(function() {/*! | 381 this.runWithLoadedTree(function() {/*! |
| 381 <ul role="tree"> | 382 <ul role="tree"> |
| 382 <li aria-expanded="true" role="treeitem">a | 383 <li aria-expanded="true" role="treeitem">a |
| 383 <li role="treeitem">b | 384 <li role="treeitem">b |
| 384 <li aria-expanded="false" role="treeitem">c | 385 <li aria-expanded="false" role="treeitem">c |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 assertEquals('This fragment Should be separated with spaces' | 643 assertEquals('This fragment Should be separated with spaces' |
| 643 , joined.speechOutputForTest.string_); | 644 , joined.speechOutputForTest.string_); |
| 644 }); | 645 }); |
| 645 }); | 646 }); |
| 646 | 647 |
| 647 TEST_F('OutputE2ETest', 'ComplexDiv', function() { | 648 TEST_F('OutputE2ETest', 'ComplexDiv', function() { |
| 648 this.runWithLoadedTree(function() {/*! | 649 this.runWithLoadedTree(function() {/*! |
| 649 <div><button>ok</button></div> | 650 <div><button>ok</button></div> |
| 650 */}, | 651 */}, |
| 651 function(root) { | 652 function(root) { |
| 652 var div = root.find({role: 'div'}); | 653 var div = root.find({role: 'genericContainer'}); |
| 653 var o = new Output().withSpeech(cursors.Range.fromNode(div)); | 654 var o = new Output().withSpeech(cursors.Range.fromNode(div)); |
| 654 assertEquals('ok', o.speechOutputForTest.string_); | 655 assertEquals('ok', o.speechOutputForTest.string_); |
| 655 }); | 656 }); |
| 656 }); | 657 }); |
| 657 | 658 |
| 658 TEST_F('OutputE2ETest', 'ContainerFocus', function() { | 659 TEST_F('OutputE2ETest', 'ContainerFocus', function() { |
| 659 this.runWithLoadedTree(function() {/*! | 660 this.runWithLoadedTree(function() {/*! |
| 660 <div role="row" tabindex=0 aria-label="start"></div> | 661 <div role="row" tabindex=0 aria-label="start"></div> |
| 661 <div role="row" tabindex=0 aria-label="end"></div> | 662 <div role="row" tabindex=0 aria-label="end"></div> |
| 662 */}, | 663 */}, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 763 checkSpeechOutput('2|Min 1|Max 10|volume|Spin button', | 764 checkSpeechOutput('2|Min 1|Max 10|volume|Spin button', |
| 764 [ | 765 [ |
| 765 {value: 'valueForRange', start: 0, end: 1}, | 766 {value: 'valueForRange', start: 0, end: 1}, |
| 766 {value: 'name', start: 15,end: 21}, | 767 {value: 'name', start: 15,end: 21}, |
| 767 {value: new Output.EarconAction('LISTBOX'), start: 15, end: 21}, | 768 {value: new Output.EarconAction('LISTBOX'), start: 15, end: 21}, |
| 768 {value: 'role', start: 22, end: 33} | 769 {value: 'role', start: 22, end: 33} |
| 769 ], | 770 ], |
| 770 o); | 771 o); |
| 771 }); | 772 }); |
| 772 }); | 773 }); |
| OLD | NEW |