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', 'RichTextLinkOutput', function() { |
| 411 var mockFeedback = this.createMockFeedback(); |
| 412 this.runWithLoadedTree(function() {/*! |
| 413 <div id="go" role="textbox" contenteditable>a <a href="#">test</a></div> |
| 414 |
| 415 <script> |
| 416 document.getElementById('go').addEventListener('click', function() { |
| 417 var sel = getSelection(); |
| 418 sel.modify('move', '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 var lineText = 'a test'; |
| 425 |
| 426 this.listenOnce(input, 'focus', function() { |
| 427 mockFeedback.call(moveByChar) |
| 428 .expectSpeech(' ') |
| 429 .expectBraille(lineText, { startIndex: 1, endIndex: 1 }) |
| 430 .call(moveByChar) |
| 431 .expectSpeech('t') |
| 432 .expectSpeech('Link start') |
| 433 .expectSpeech('Underline start') |
| 434 .expectBraille(lineText, { startIndex: 2, endIndex: 2 }) |
| 435 .call(moveByChar) |
| 436 .expectSpeech('e') |
| 437 .expectBraille(lineText, { startIndex: 3, endIndex: 3 }) |
| 438 .call(moveByChar) |
| 439 .expectSpeech('s') |
| 440 .expectBraille(lineText, { startIndex: 4, endIndex: 4 }) |
| 441 .call(moveByChar) |
| 442 .expectSpeech('t') |
| 443 .expectSpeech('Link end') |
| 444 .expectSpeech('Underline end') |
| 445 .expectBraille(lineText, { startIndex: 5, endIndex: 5 }) |
| 446 |
| 447 .replay(); |
| 448 }); |
| 449 input.focus(); |
| 450 }); |
| 451 }); |
| 452 |
410 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { | 453 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { |
411 this.runWithLoadedTree(function() {/*! | 454 this.runWithLoadedTree(function() {/*! |
412 <p contenteditable style="word-spacing:100000px">this is a test</p> | 455 <p contenteditable style="word-spacing:100000px">this is a test</p> |
413 */}, function(root) { | 456 */}, function(root) { |
414 var staticText = root.find({role: RoleType.STATIC_TEXT}); | 457 var staticText = root.find({role: RoleType.STATIC_TEXT}); |
415 | 458 |
416 var e = new editing.EditableLine(staticText, 0, staticText, 0); | 459 var e = new editing.EditableLine(staticText, 0, staticText, 0); |
417 assertEquals('this ', e.text); | 460 assertEquals('this ', e.text); |
418 | 461 |
419 assertEquals(0, e.startOffset); | 462 assertEquals(0, e.startOffset); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 assertEquals(0, e1.startOffset); | 723 assertEquals(0, e1.startOffset); |
681 assertEquals(2, e1.endOffset); | 724 assertEquals(2, e1.endOffset); |
682 | 725 |
683 // Across paragraph selection with base line on anchor. | 726 // Across paragraph selection with base line on anchor. |
684 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); | 727 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); |
685 assertEquals('is ', e1.text); | 728 assertEquals('is ', e1.text); |
686 assertEquals(0, e1.startOffset); | 729 assertEquals(0, e1.startOffset); |
687 assertEquals(3, e1.endOffset); | 730 assertEquals(3, e1.endOffset); |
688 }) | 731 }) |
689 }); | 732 }); |
OLD | NEW |