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', 'Checkbox', function() { | |
88 this.runWithLoadedTree('<input type="checkbox">', | |
89 function(root) { | |
90 var el = root.firstChild.firstChild; | |
91 var range = cursors.Range.fromNode(el); | |
92 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
93 assertEqualsJSON({string_: 'Check boxnot checked', 'spans_': [ | |
94 // Attributes. | |
95 {value: 'name', start: 0, end: 0}, | |
96 {value: 'role', start: 0, end: 9}, | |
97 {value: 'state', start: 9, end: 20}, | |
98 | |
99 // Link earcon (based on the state). | |
100 {value: {}, start: 9, end: 20} | |
101 ]}, o.toSpannable()); | |
102 }); | |
103 }); | |
104 | |
105 TEST_F('OutputE2ETest', 'InLineTextBoxValueGetsIgnored', function() { | |
106 this.runWithLoadedTree('<p>OK', | |
107 function(root) { | |
108 var el = root.firstChild.firstChild.firstChild; | |
109 assertEquals('inlineTextBox', el.role); | |
110 var range = cursors.Range.fromNode(el); | |
111 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
112 assertEqualsJSON({string_: 'OK', 'spans_': [ | |
113 // Attributes. | |
114 {value: 'name', start: 0, end: 2} | |
115 ]}, o.toSpannable()); | |
116 | |
117 el = root.firstChild.firstChild; | |
118 assertEquals('staticText', el.role); | |
119 range = cursors.Range.fromNode(el); | |
120 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
121 assertEqualsJSON({string_: 'OK', 'spans_': [ | |
122 // Attributes. | |
123 {value: 'value', start: 0, end: 2}, | |
124 | |
125 // The name is an empty string. | |
126 {value: 'name', start: 2, end: 2} | |
127 ]}, o.toSpannable()); | |
128 }); | |
129 }); | |
130 | |
131 TEST_F('OutputE2ETest', 'Headings', function() { | |
132 this.runWithLoadedTree( | |
133 '<h1>a</h1><h2>b</h2><h3>c</h3><h4>d</h4><h5>e</h5><h6>f</h6>', | |
134 function(root) { | |
135 var el = root.firstChild; | |
136 var range = cursors.Range.fromNode(el); | |
137 var o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
138 assertEqualsJSON({string_: 'Heading 1a', 'spans_': [ | |
dmazzoni
2015/04/15 21:06:06
I'd be happier if toSpannable didn't run things to
| |
139 // Attributes. | |
140 {value: 'name', start: 9, end: 10} | |
141 ]}, o.toSpannable()); | |
142 | |
143 el = el.nextSibling; | |
144 range = cursors.Range.fromNode(el); | |
145 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
146 assertEqualsJSON({string_: 'Heading 2b', 'spans_': [ | |
147 // Attributes. | |
148 {value: 'name', start: 9, end: 10} | |
149 ]}, o.toSpannable()); | |
150 | |
151 el = el.nextSibling; | |
152 range = cursors.Range.fromNode(el); | |
153 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
154 assertEqualsJSON({string_: 'Heading 3c', 'spans_': [ | |
155 // Attributes. | |
156 {value: 'name', start: 9, end: 10} | |
157 ]}, o.toSpannable()); | |
158 | |
159 el = el.nextSibling; | |
160 range = cursors.Range.fromNode(el); | |
161 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
162 assertEqualsJSON({string_: 'Heading 4d', 'spans_': [ | |
163 // Attributes. | |
164 {value: 'name', start: 9, end: 10} | |
165 ]}, o.toSpannable()); | |
166 | |
167 el = el.nextSibling; | |
168 range = cursors.Range.fromNode(el); | |
169 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
170 assertEqualsJSON({string_: 'Heading 5e', 'spans_': [ | |
171 // Attributes. | |
172 {value: 'name', start: 9, end: 10} | |
173 ]}, o.toSpannable()); | |
174 | |
175 el = el.nextSibling; | |
176 range = cursors.Range.fromNode(el); | |
177 o = new Output().withSpeechAndBraille(range, null, 'navigate'); | |
178 assertEqualsJSON({string_: 'Heading 6f', 'spans_': [ | |
179 // Attributes. | |
180 {value: 'name', start: 9, end: 10} | |
181 ]}, o.toSpannable()); | |
182 }); | |
183 }); | |
OLD | NEW |