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 * Test fixture for output.js. | 9 * Test fixture for output.js. |
10 * @constructor | 10 * @constructor |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | 76 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
77 assertEqualsJSON({string_: 'OK', 'spans_': [ | 77 assertEqualsJSON({string_: 'OK', 'spans_': [ |
78 // Attributes. | 78 // Attributes. |
79 {value: 'value', start: 0, end: 2}, | 79 {value: 'value', start: 0, end: 2}, |
80 | 80 |
81 // The name is an empty string. | 81 // The name is an empty string. |
82 {value: 'name', start: 2, end: 2} | 82 {value: 'name', start: 2, end: 2} |
83 ]}, o.toSpannable()); | 83 ]}, o.toSpannable()); |
84 }); | 84 }); |
85 }); | 85 }); |
| 86 |
| 87 TEST_F('OutputE2ETest', 'Headings', function() { |
| 88 this.runWithLoadedTree( |
| 89 '<h1>a</h1><h2>b</h2><h3>c</h3><h4>d</h4><h5>e</h5><h6>f</h6>', |
| 90 function(root) { |
| 91 var el = root.firstChild; |
| 92 var range = cursors.Range.fromNode(el); |
| 93 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 94 assertEqualsJSON({string_: 'Heading 1a', 'spans_': [ |
| 95 // Attributes. |
| 96 {value: 'name', start: 9, end: 10} |
| 97 ]}, o.toSpannable()); |
| 98 |
| 99 el = el.nextSibling; |
| 100 range = cursors.Range.fromNode(el); |
| 101 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 102 assertEqualsJSON({string_: 'Heading 2b', 'spans_': [ |
| 103 // Attributes. |
| 104 {value: 'name', start: 9, end: 10} |
| 105 ]}, o.toSpannable()); |
| 106 |
| 107 el = el.nextSibling; |
| 108 range = cursors.Range.fromNode(el); |
| 109 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 110 assertEqualsJSON({string_: 'Heading 3c', 'spans_': [ |
| 111 // Attributes. |
| 112 {value: 'name', start: 9, end: 10} |
| 113 ]}, o.toSpannable()); |
| 114 |
| 115 el = el.nextSibling; |
| 116 range = cursors.Range.fromNode(el); |
| 117 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 118 assertEqualsJSON({string_: 'Heading 4d', 'spans_': [ |
| 119 // Attributes. |
| 120 {value: 'name', start: 9, end: 10} |
| 121 ]}, o.toSpannable()); |
| 122 |
| 123 el = el.nextSibling; |
| 124 range = cursors.Range.fromNode(el); |
| 125 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 126 assertEqualsJSON({string_: 'Heading 5e', 'spans_': [ |
| 127 // Attributes. |
| 128 {value: 'name', start: 9, end: 10} |
| 129 ]}, o.toSpannable()); |
| 130 |
| 131 el = el.nextSibling; |
| 132 range = cursors.Range.fromNode(el); |
| 133 o = new Output().withSpeechAndBraille(range, null, 'navigate'); |
| 134 assertEqualsJSON({string_: 'Heading 6f', 'spans_': [ |
| 135 // Attributes. |
| 136 {value: 'name', start: 9, end: 10} |
| 137 ]}, o.toSpannable()); |
| 138 }); |
| 139 }); |
OLD | NEW |