| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 o); | 125 o); |
| 126 }); | 126 }); |
| 127 }); | 127 }); |
| 128 | 128 |
| 129 TEST_F('OutputE2ETest', 'Checkbox', function() { | 129 TEST_F('OutputE2ETest', 'Checkbox', function() { |
| 130 this.runWithLoadedTree('<input type="checkbox">', | 130 this.runWithLoadedTree('<input type="checkbox">', |
| 131 function(root) { | 131 function(root) { |
| 132 var el = root.firstChild.firstChild; | 132 var el = root.firstChild.firstChild; |
| 133 var range = cursors.Range.fromNode(el); | 133 var range = cursors.Range.fromNode(el); |
| 134 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 134 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 135 checkSpeechOutput('|Check box|not checked', | 135 checkSpeechOutput('|Check box|Not checked', |
| 136 [ | 136 [ |
| 137 {value: new Output.EarconAction('CHECK_OFF'), start: 0, end: 0}, | 137 {value: new Output.EarconAction('CHECK_OFF'), start: 0, end: 0}, |
| 138 {value: 'role', start: 1, end: 10}, | 138 {value: 'role', start: 1, end: 10} |
| 139 {value: 'state', start: 11, end: 22} | |
| 140 ], | 139 ], |
| 141 o); | 140 o); |
| 142 checkBrailleOutput( | 141 checkBrailleOutput( |
| 143 'chk ( )', | 142 'chk ( )', |
| 144 [{value: new Output.NodeSpan(el), start: 0, end: 7}], | 143 [{value: new Output.NodeSpan(el), start: 0, end: 7}], |
| 145 o); | 144 o); |
| 146 }); | 145 }); |
| 147 }); | 146 }); |
| 148 | 147 |
| 149 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { | 148 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 Msgs.getMsg(value.msgId + '_brl'); | 496 Msgs.getMsg(value.msgId + '_brl'); |
| 498 assertFalse(/[A-Z]+/.test(value.msgId)); | 497 assertFalse(/[A-Z]+/.test(value.msgId)); |
| 499 } | 498 } |
| 500 if (value.earconId) | 499 if (value.earconId) |
| 501 assertNotNullNorUndefined(cvox.Earcon[value.earconId]); | 500 assertNotNullNorUndefined(cvox.Earcon[value.earconId]); |
| 502 } | 501 } |
| 503 for (var key in Output.STATE_INFO_) { | 502 for (var key in Output.STATE_INFO_) { |
| 504 var value = Output.STATE_INFO_[key]; | 503 var value = Output.STATE_INFO_[key]; |
| 505 for (innerKey in value) { | 504 for (innerKey in value) { |
| 506 var innerValue = value[innerKey]; | 505 var innerValue = value[innerKey]; |
| 506 if (typeof(innerValue) == 'boolean') { |
| 507 assertEquals('isRoleSpecific', innerKey); |
| 508 continue; |
| 509 } |
| 507 Msgs.getMsg(innerValue.msgId); | 510 Msgs.getMsg(innerValue.msgId); |
| 508 Msgs.getMsg(innerValue.msgId + '_brl'); | 511 Msgs.getMsg(innerValue.msgId + '_brl'); |
| 509 assertFalse(/[A-Z]+/.test(innerValue.msgId)); | 512 assertFalse(/[A-Z]+/.test(innerValue.msgId)); |
| 510 if (innerValue.earconId) | 513 if (innerValue.earconId) |
| 511 assertNotNullNorUndefined(cvox.Earcon[innerValue.earconId]); | 514 assertNotNullNorUndefined(cvox.Earcon[innerValue.earconId]); |
| 512 } | 515 } |
| 513 } | 516 } |
| 514 for (var key in Output.INPUT_TYPE_MESSAGE_IDS_) { | 517 for (var key in Output.INPUT_TYPE_MESSAGE_IDS_) { |
| 515 var msgId = Output.INPUT_TYPE_MESSAGE_IDS_[key]; | 518 var msgId = Output.INPUT_TYPE_MESSAGE_IDS_[key]; |
| 516 assertFalse(/[A-Z]+/.test(msgId)); | 519 assertFalse(/[A-Z]+/.test(msgId)); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 }); | 614 }); |
| 612 TEST_F('OutputE2ETest', 'ToggleButton', function() { | 615 TEST_F('OutputE2ETest', 'ToggleButton', function() { |
| 613 this.runWithLoadedTree(function() {/*! | 616 this.runWithLoadedTree(function() {/*! |
| 614 <div role="button" aria-pressed="true">Subscribe</div>*/}, | 617 <div role="button" aria-pressed="true">Subscribe</div>*/}, |
| 615 function(root) { | 618 function(root) { |
| 616 var el = root.firstChild; | 619 var el = root.firstChild; |
| 617 var o = new Output().withSpeech(cursors.Range.fromNode(el)); | 620 var o = new Output().withSpeech(cursors.Range.fromNode(el)); |
| 618 assertEqualsJSON({string_: '|Subscribe|Button|Pressed', spans_: [ | 621 assertEqualsJSON({string_: '|Subscribe|Button|Pressed', spans_: [ |
| 619 {value: {earconId: 'CHECK_ON'}, start: 0, end: 0}, | 622 {value: {earconId: 'CHECK_ON'}, start: 0, end: 0}, |
| 620 {value: 'name', start: 1, end:10}, | 623 {value: 'name', start: 1, end:10}, |
| 621 {value: 'role', start: 11, end: 17} | 624 {value: 'role', start: 11, end: 17}, |
| 625 {value: 'state', start: 18, end: 25} |
| 622 ]}, o.speechOutputForTest); | 626 ]}, o.speechOutputForTest); |
| 623 }); | 627 }); |
| 624 }); | 628 }); |
| 625 | 629 |
| 626 TEST_F('OutputE2ETest', 'JoinDescendants', function() { | 630 TEST_F('OutputE2ETest', 'JoinDescendants', function() { |
| 627 this.runWithLoadedTree(function() {/*! | 631 this.runWithLoadedTree(function() {/*! |
| 628 <p>This</p> | 632 <p>This</p> |
| 629 <p>fragment</p> | 633 <p>fragment</p> |
| 630 <p>Should be separated</p> | 634 <p>Should be separated</p> |
| 631 <p>with spaces</p> | 635 <p>with spaces</p> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 657 <div role="row" tabindex=0 aria-label="start"></div> | 661 <div role="row" tabindex=0 aria-label="start"></div> |
| 658 <div role="row" tabindex=0 aria-label="end"></div> | 662 <div role="row" tabindex=0 aria-label="end"></div> |
| 659 */}, | 663 */}, |
| 660 function(root) { | 664 function(root) { |
| 661 var r1 = cursors.Range.fromNode(root.firstChild); | 665 var r1 = cursors.Range.fromNode(root.firstChild); |
| 662 var r2 = cursors.Range.fromNode(root.lastChild); | 666 var r2 = cursors.Range.fromNode(root.lastChild); |
| 663 assertEquals('start|Row', | 667 assertEquals('start|Row', |
| 664 new Output().withSpeech(r1, r2).speechOutputForTest.string_); | 668 new Output().withSpeech(r1, r2).speechOutputForTest.string_); |
| 665 }); | 669 }); |
| 666 }); | 670 }); |
| OLD | NEW |