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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 .call(moveByChar) | 400 .call(moveByChar) |
401 .expectSpeech('\n') | 401 .expectSpeech('\n') |
402 .expectBraille(lineText, { startIndex: 4, endIndex: 4 }) | 402 .expectBraille(lineText, { startIndex: 4, endIndex: 4 }) |
403 | 403 |
404 .replay(); | 404 .replay(); |
405 }); | 405 }); |
406 input.focus(); | 406 input.focus(); |
407 }); | 407 }); |
408 }); | 408 }); |
409 | 409 |
| 410 TEST_F('EditingTest', 'RichTextExtendByCharacter', function() { |
| 411 var mockFeedback = this.createMockFeedback(); |
| 412 this.runWithLoadedTree(function() {/*! |
| 413 <div id="go" role="textbox" contenteditable>Te<br>st</div> |
| 414 |
| 415 <script> |
| 416 document.getElementById('go').addEventListener('click', function() { |
| 417 var sel = getSelection(); |
| 418 sel.modify('extend', 'forward', 'character'); |
| 419 }, true); |
| 420 </script> |
| 421 */}, function(root) { |
| 422 var input = root.find({role: RoleType.TEXT_FIELD}); |
| 423 var moveByChar = input.doDefault.bind(input); |
| 424 |
| 425 this.listenOnce(input, 'focus', function() { |
| 426 mockFeedback.call(moveByChar) |
| 427 .expectSpeech('T', 'selected') |
| 428 .call(moveByChar) |
| 429 .expectSpeech('e', 'added to selection') |
| 430 .call(moveByChar) |
| 431 .expectSpeech('selected') |
| 432 .call(moveByChar) |
| 433 // This gets described by the line logic in EditableLine. |
| 434 .expectSpeech('s', 'selected') |
| 435 .call(moveByChar) |
| 436 .expectSpeech('t', 'added to selection') |
| 437 |
| 438 .replay(); |
| 439 }); |
| 440 input.focus(); |
| 441 }); |
| 442 }); |
| 443 |
410 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { | 444 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { |
411 this.runWithLoadedTree(function() {/*! | 445 this.runWithLoadedTree(function() {/*! |
412 <p contenteditable style="word-spacing:100000px">this is a test</p> | 446 <p contenteditable style="word-spacing:100000px">this is a test</p> |
413 */}, function(root) { | 447 */}, function(root) { |
414 var staticText = root.find({role: RoleType.STATIC_TEXT}); | 448 var staticText = root.find({role: RoleType.STATIC_TEXT}); |
415 | 449 |
416 var e = new editing.EditableLine(staticText, 0, staticText, 0); | 450 var e = new editing.EditableLine(staticText, 0, staticText, 0); |
417 assertEquals('this ', e.text); | 451 assertEquals('this ', e.text); |
418 | 452 |
419 assertEquals(0, e.startOffset); | 453 assertEquals(0, e.startOffset); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 assertEquals(0, e1.startOffset); | 714 assertEquals(0, e1.startOffset); |
681 assertEquals(2, e1.endOffset); | 715 assertEquals(2, e1.endOffset); |
682 | 716 |
683 // Across paragraph selection with base line on anchor. | 717 // Across paragraph selection with base line on anchor. |
684 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); | 718 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); |
685 assertEquals('is ', e1.text); | 719 assertEquals('is ', e1.text); |
686 assertEquals(0, e1.startOffset); | 720 assertEquals(0, e1.startOffset); |
687 assertEquals(3, e1.endOffset); | 721 assertEquals(3, e1.endOffset); |
688 }) | 722 }) |
689 }); | 723 }); |
OLD | NEW |