Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs

Issue 2968943003: Revert of Expand EditableLine to include non-inline text box leafs (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 .expectSpeech('s', 'selected') 477 .expectSpeech('s', 'selected')
478 .call(moveByChar) 478 .call(moveByChar)
479 .expectSpeech('t', 'added to selection') 479 .expectSpeech('t', 'added to selection')
480 480
481 .replay(); 481 .replay();
482 }); 482 });
483 input.focus(); 483 input.focus();
484 }); 484 });
485 }); 485 });
486 486
487 TEST_F('EditingTest', 'RichTextImageByCharacter', function() {
488 var mockFeedback = this.createMockFeedback();
489 this.runWithLoadedTree(function() {/*!
490 <p id="go" contenteditable>
491 <img alt="dog"></img> is a <img alt="cat"</img> test
492 </p>
493 <script>
494 document.getElementById('go').addEventListener('click', function() {
495 var sel = getSelection();
496 sel.modify('move', 'forward', 'character');
497 }, true);
498 </script>
499 */}, function(root) {
500 var input = root.find({role: RoleType.PARAGRAPH});
501 var moveByChar = input.doDefault.bind(input);
502
503 this.listenOnce(input, 'focus', function() {
504 var lineText = 'dog is a cat test';
505 mockFeedback.call(moveByChar)
506 // Note that this isn't quite correct. This should be the second
507 // character which is a space ' '.
508 .expectSpeech('dog', 'Image')
509 // Ditto.
510 .expectBraille(lineText, {startIndex: 0, endIndex: 0})
511 .call(moveByChar)
512 .expectSpeech('i')
513 .expectBraille(lineText, {startIndex: 4, endIndex: 4})
514 .call(moveByChar)
515 .expectSpeech('s')
516 .expectBraille(lineText, {startIndex: 5, endIndex: 5})
517 .call(moveByChar)
518 .expectSpeech(' ')
519 .expectBraille(lineText, {startIndex: 6, endIndex: 6})
520 .call(moveByChar)
521 .expectSpeech('a')
522 .expectBraille(lineText, {startIndex: 7, endIndex: 7})
523 .call(moveByChar)
524 .expectSpeech(' ')
525 .expectBraille(lineText, {startIndex: 8, endIndex: 8})
526 .call(moveByChar)
527
528 // This is technically wrong because we're actually over the entire
529 // image. This is broken because of bad node offsets.
530 .expectSpeech('c')
531 .expectBraille(lineText, {startIndex: 9, endIndex: 9})
532
533 // Unfortunately, the node offset being wrong here means there's no
534 // output for this character move which gets us past the cat image
535 // node.
536 .call(moveByChar)
537
538 // And, we're back (skipped the space).
539 .call(moveByChar)
540 // Unfortunately, due to the above, we think we're on a new line and
541 // read it all.
542 .expectSpeech('dog', 'Image', ' is a ', 'cat', 'Image', ' test')
543 // But, we're at least on the right caret position.
544 .expectBraille(lineText, {startIndex: 13, endIndex: 13})
545
546 .replay();
547 });
548 input.focus();
549 });
550 });
551
552 TEST_F('EditingTest', 'EditableLineOneStaticText', function() { 487 TEST_F('EditingTest', 'EditableLineOneStaticText', function() {
553 this.runWithLoadedTree(function() {/*! 488 this.runWithLoadedTree(function() {/*!
554 <p contenteditable style="word-spacing:100000px">this is a test</p> 489 <p contenteditable style="word-spacing:100000px">this is a test</p>
555 */}, function(root) { 490 */}, function(root) {
556 var staticText = root.find({role: RoleType.STATIC_TEXT}); 491 var staticText = root.find({role: RoleType.STATIC_TEXT});
557 492
558 var e = new editing.EditableLine(staticText, 0, staticText, 0); 493 var e = new editing.EditableLine(staticText, 0, staticText, 0);
559 assertEquals('this ', e.text); 494 assertEquals('this ', e.text);
560 495
561 assertEquals(0, e.startOffset); 496 assertEquals(0, e.startOffset);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 assertEquals(0, e1.startOffset); 757 assertEquals(0, e1.startOffset);
823 assertEquals(2, e1.endOffset); 758 assertEquals(2, e1.endOffset);
824 759
825 // Across paragraph selection with base line on anchor. 760 // Across paragraph selection with base line on anchor.
826 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true); 761 e1 = new editing.EditableLine(thisIsATest, 5, hello, 2, true);
827 assertEquals('is ', e1.text); 762 assertEquals('is ', e1.text);
828 assertEquals(0, e1.startOffset); 763 assertEquals(0, e1.startOffset);
829 assertEquals(3, e1.endOffset); 764 assertEquals(3, e1.endOffset);
830 }) 765 })
831 }); 766 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698