| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Include test fixture. | 5 // Include test fixture. |
| 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js', | 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js', |
| 7 '../../testing/assert_additions.js']); | 7 '../../testing/assert_additions.js']); |
| 8 | 8 |
| 9 GEN_INCLUDE(['../../testing/mock_feedback.js']); | 9 GEN_INCLUDE(['../../testing/mock_feedback.js']); |
| 10 | 10 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 .call(input.setSelection.bind(input, 5, 5)) | 156 .call(input.setSelection.bind(input, 5, 5)) |
| 157 .expectBraille('text2 ed', {startIndex: 5, endIndex: 5}) | 157 .expectBraille('text2 ed', {startIndex: 5, endIndex: 5}) |
| 158 .expectSpeech('text2'); | 158 .expectSpeech('text2'); |
| 159 | 159 |
| 160 mockFeedback.replay(); | 160 mockFeedback.replay(); |
| 161 }); | 161 }); |
| 162 }); | 162 }); |
| 163 | 163 |
| 164 TEST_F('EditingTest', 'OneLineBreak', function() { | 164 TEST_F('EditingTest', 'OneLineBreak', function() { |
| 165 this.assertLineData(function() {/*! | 165 this.assertLineData(function() {/*! |
| 166 <div role="textbox" contenteditable>this is a<br>test</div> | 166 <div role="textbox" contenteditable aria-multiline="true"> |
| 167 this is a<br>test</div> |
| 167 */}, | 168 */}, |
| 168 [ | 169 [ |
| 169 {start: 0, end: 9, text: 'this is a'}, | 170 {start: 0, end: 9, text: 'this is a'}, |
| 170 {start: 10, end: 14, text: 'test'} | 171 {start: 10, end: 14, text: 'test'} |
| 171 ]); | 172 ]); |
| 172 }); | 173 }); |
| 173 | 174 |
| 174 TEST_F('EditingTest', 'TwoLineBreaks', function() { | 175 TEST_F('EditingTest', 'TwoLineBreaks', function() { |
| 175 this.assertLineData(function() {/*! | 176 this.assertLineData(function() {/*! |
| 176 <div role="textbox" contenteditable>this is a<br><br> | 177 <div role="textbox" contenteditable aria-multiline="true"> |
| 177 test</div> | 178 this is a<br><br>test</div> |
| 178 */}, | 179 */}, |
| 179 [ | 180 [ |
| 180 {start: 0, end: 9, text: 'this is a'}, | 181 {start: 0, end: 9, text: 'this is a'}, |
| 181 {start: 10, end: 10, text: ''}, | 182 {start: 10, end: 10, text: ''}, |
| 182 {start: 11, end: 15, text: 'test'}, | 183 {start: 11, end: 15, text: 'test'}, |
| 183 ]); | 184 ]); |
| 184 }); | 185 }); |
| 185 | 186 |
| 186 TEST_F('EditingTest', 'InitialBreaks', function() { | 187 TEST_F('EditingTest', 'InitialBreaks', function() { |
| 187 this.assertLineData(function() {/*! | 188 this.assertLineData(function() {/*! |
| 188 <div role="textbox" contenteditable><br><br><br> | 189 <div role="textbox" contenteditable aria-multiline="true"><br><br><br> |
| 189 this is a</div> | 190 this is a</div> |
| 190 */}, | 191 */}, |
| 191 [ | 192 [ |
| 192 {start: 0, end: 0, text: ''}, | 193 {start: 0, end: 0, text: ''}, |
| 193 {start: 1, end: 1, text: ''}, | 194 {start: 1, end: 1, text: ''}, |
| 194 {start: 2, end: 2, text: ''}, | 195 {start: 2, end: 2, text: ''}, |
| 195 {start: 3, end: 12, text: 'this is a'}, | 196 {start: 3, end: 12, text: 'this is a'}, |
| 196 ]); | 197 ]); |
| 197 }); | 198 }); |
| 198 | 199 |
| 199 TEST_F('EditingTest', 'SingleCharacterLine', function() { | 200 TEST_F('EditingTest', 'SingleCharacterLine', function() { |
| 200 this.assertLineData(function() {/*! | 201 this.assertLineData(function() {/*! |
| 201 <div role="textbox" contenteditable> | 202 <div role="textbox" contenteditable aria-multiline="true"> |
| 202 <div>this</div><br> | 203 <div>this</div><br> |
| 203 <div><br> | 204 <div><br> |
| 204 I<br> | 205 I<br> |
| 205 can test</div></div> | 206 can test</div></div> |
| 206 */}, | 207 */}, |
| 207 [ | 208 [ |
| 208 {start: 0, end: 4, text: 'this'}, | 209 {start: 0, end: 4, text: 'this'}, |
| 209 {start: 5, end: 5, text: ''}, | 210 {start: 5, end: 5, text: ''}, |
| 210 {start: 6, end: 6, text: ''}, | 211 {start: 6, end: 6, text: ''}, |
| 211 {start: 7, end: 8, text: 'I'}, | 212 {start: 7, end: 8, text: 'I'}, |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 assertEquals(0, e1.startOffset); | 814 assertEquals(0, e1.startOffset); |
| 814 assertEquals(2, e1.endOffset); | 815 assertEquals(2, e1.endOffset); |
| 815 | 816 |
| 816 // Across paragraph selection with base line on anchor. | 817 // Across paragraph selection with base line on anchor. |
| 817 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); | 818 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); |
| 818 assertEquals('is ', e1.text); | 819 assertEquals('is ', e1.text); |
| 819 assertEquals(0, e1.startOffset); | 820 assertEquals(0, e1.startOffset); |
| 820 assertEquals(3, e1.endOffset); | 821 assertEquals(3, e1.endOffset); |
| 821 }) | 822 }) |
| 822 }); | 823 }); |
| OLD | NEW |