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

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

Issue 2903973002: Rich editable text implementation using spannables (Closed)
Patch Set: wip Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
index c1ecc2b8392d7d1fc2bbaac7fcd283a5d607b736..251c90ac6c9f9528c1b5fe14a8575eaea0031e13 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
@@ -242,6 +242,7 @@ TEST_F('EditingTest', 'RichTextMoveByLine', function() {
var input = root.find({role: RoleType.TEXT_FIELD});
var moveByLine = input.doDefault.bind(input);
mockFeedback.call(input.focus.bind(input))
+ .expectSpeech('Text area')
.call(moveByLine)
.expectSpeech('blank')
.expectBraille('')
@@ -253,7 +254,76 @@ TEST_F('EditingTest', 'RichTextMoveByLine', function() {
.expectBraille('')
.call(moveByLine)
.expectSpeech('hello', 'Heading 2')
- .expectBraille('hello h2')
+ .expectBraille('hello h2 \n')
+ .replay();
+ });
+});
+
+TEST_F('EditingTest', 'RichTextMoveByCharacter', function() {
+ editing.useRichText = true;
+ var mockFeedback = this.createMockFeedback();
+ this.runWithLoadedTree(function() {/*!
+ <div id="go" role="textbox" contenteditable>This <b>is</b> a test.</div>
+
+ <script>
+ var dir = 'forward';
+ var char = 0;
+ document.getElementById('go').addEventListener('click', function() {
+ var sel = getSelection();
+ sel.modify('move', dir, 'character');
+ if (dir == 'forward')
+ char++;
+ else
+ char--;
+
+ if (char == 0)
+ dir = 'forward';
+ if (line == 16)
+ dir = 'backward';
+ }, true);
+ </script>
+ */}, function(root) {
+ // Note that the braille output below is wrong. It depends on Chrome
+ // providing apis for getting the current visual line.
+
+ var input = root.find({role: RoleType.TEXT_FIELD});
+ var moveByChar = input.doDefault.bind(input);
+ mockFeedback.call(input.focus.bind(input))
+ .expectSpeech('Text area')
+ .call(moveByChar)
+ .expectSpeech('h')
+ .expectBraille('This ', { startIndex: 1, endIndex: 1 })
+ .call(moveByChar)
+ .expectSpeech('i')
+ .expectBraille('This ', { startIndex: 2, endIndex: 2 })
+ .call(moveByChar)
+ .expectSpeech('s')
+ .expectBraille('This ', { startIndex: 3, endIndex: 3 })
+ .call(moveByChar)
+ .expectSpeech(' ')
+ .expectBraille('This ', { startIndex: 4, endIndex: 4 })
+
+ .call(moveByChar)
+ .expectSpeech('i')
+ .expectBraille(' ', { startIndex: 0, endIndex: 0 })
+
+ .call(moveByChar)
+ .expectSpeech('s')
+ .expectBraille('is', { startIndex: 1, endIndex: 1 })
+
+ // This is a move from one static text to another. It is not clear what
+ // needs to be read here, so currently, it is left silent. The new node
+ // initializes the plain text state machine.
+ .call(moveByChar)
+
+ .call(moveByChar)
+ .expectSpeech('a')
+ .expectBraille(' a test.', { startIndex: 1, endIndex: 1 })
+
+ .call(moveByChar)
+ .expectSpeech(' ')
+ .expectBraille(' a test.', { startIndex: 2, endIndex: 2 })
+
.replay();
});
});

Powered by Google App Engine
This is Rietveld 408576698