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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 .expectBraille(lineText, { startIndex: 5, endIndex: 5 }) | 366 .expectBraille(lineText, { startIndex: 5, endIndex: 5 }) |
367 .call(moveByChar) | 367 .call(moveByChar) |
368 .expectSpeech('w') | 368 .expectSpeech('w') |
369 .expectBraille(lineText, { startIndex: 6, endIndex: 6 }) | 369 .expectBraille(lineText, { startIndex: 6, endIndex: 6 }) |
370 .replay(); | 370 .replay(); |
371 }); | 371 }); |
372 input.focus(); | 372 input.focus(); |
373 }); | 373 }); |
374 }); | 374 }); |
375 | 375 |
| 376 TEST_F('EditingTest', 'RichTextMoveByCharacterEndOfLine', function() { |
| 377 editing.useRichText = true; |
| 378 var mockFeedback = this.createMockFeedback(); |
| 379 this.runWithLoadedTree(function() {/*! |
| 380 <div id="go" role="textbox" contenteditable>Test</div> |
| 381 |
| 382 <script> |
| 383 document.getElementById('go').addEventListener('click', function() { |
| 384 var sel = getSelection(); |
| 385 sel.modify('move', 'forward', 'character'); |
| 386 }, true); |
| 387 </script> |
| 388 */}, function(root) { |
| 389 var input = root.find({role: RoleType.TEXT_FIELD}); |
| 390 var moveByChar = input.doDefault.bind(input); |
| 391 var lineText = 'Test'; |
| 392 |
| 393 this.listenOnce(input, 'focus', function() { |
| 394 mockFeedback.call(moveByChar) |
| 395 .expectSpeech('e') |
| 396 .expectBraille(lineText, { startIndex: 1, endIndex: 1 }) |
| 397 .call(moveByChar) |
| 398 .expectSpeech('s') |
| 399 .expectBraille(lineText, { startIndex: 2, endIndex: 2 }) |
| 400 .call(moveByChar) |
| 401 .expectSpeech('t') |
| 402 .expectBraille(lineText, { startIndex: 3, endIndex: 3 }) |
| 403 .call(moveByChar) |
| 404 .expectSpeech('\n') |
| 405 .expectBraille(lineText, { startIndex: 4, endIndex: 4 }) |
| 406 |
| 407 .replay(); |
| 408 }); |
| 409 input.focus(); |
| 410 }); |
| 411 }); |
| 412 |
376 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { | 413 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { |
377 this.runWithLoadedTree(function() {/*! | 414 this.runWithLoadedTree(function() {/*! |
378 <p contenteditable style="word-spacing:100000px">this is a test</p> | 415 <p contenteditable style="word-spacing:100000px">this is a test</p> |
379 */}, function(root) { | 416 */}, function(root) { |
380 var staticText = root.find({role: RoleType.STATIC_TEXT}); | 417 var staticText = root.find({role: RoleType.STATIC_TEXT}); |
381 | 418 |
382 var e = new editing.EditableLine(staticText, 0, staticText, 0); | 419 var e = new editing.EditableLine(staticText, 0, staticText, 0); |
383 assertEquals('this ', e.text); | 420 assertEquals('this ', e.text); |
384 | 421 |
385 assertEquals(0, e.startOffset); | 422 assertEquals(0, e.startOffset); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 assertEquals(0, e1.startOffset); | 683 assertEquals(0, e1.startOffset); |
647 assertEquals(2, e1.endOffset); | 684 assertEquals(2, e1.endOffset); |
648 | 685 |
649 // Across paragraph selection with base line on anchor. | 686 // Across paragraph selection with base line on anchor. |
650 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); | 687 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); |
651 assertEquals('is ', e1.text); | 688 assertEquals('is ', e1.text); |
652 assertEquals(0, e1.startOffset); | 689 assertEquals(0, e1.startOffset); |
653 assertEquals(3, e1.endOffset); | 690 assertEquals(3, e1.endOffset); |
654 }) | 691 }) |
655 }); | 692 }); |
OLD | NEW |