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

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

Issue 2966273002: Provide complete, smart, spoken feedback for editable selection (Closed)
Patch Set: Rename. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f589443a408f1386dc5bf1902da2b11b386f597f..abb920a04204e3b04735133bd72eb6e775fd6090 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing_test.extjs
@@ -540,6 +540,117 @@ TEST_F('EditingTest', 'RichTextImageByCharacter', function() {
});
});
+TEST_F('EditingTest', 'RichTextSelectByLine', function() {
+ var mockFeedback = this.createMockFeedback();
+ this.runWithLoadedTree(function() {/*!
+ <p id="go" contenteditable>
+ first line<br>
+ second line<br>
+ third line<br>
+ </p>
+ <script>
+ var commands = [
+ ['extend', 'forward', 'character'],
+ ['extend', 'forward', 'character'],
+
+ ['extend', 'forward', 'line'],
+ ['extend', 'forward', 'line'],
+
+ ['extend', 'backward', 'line'],
+ ['extend', 'backward', 'line'],
+
+ ['extend', 'forward', 'documentBoundary'],
+
+ ['move', 'forward', 'character'],
+ ['move', 'backward', 'character'],
+ ['move', 'backward', 'character'],
+
+ ['extend', 'backward', 'line'],
+ ['extend', 'backward', 'line'],
+
+ ['extend', 'forward', 'line'],
+ ];
+ document.getElementById('go').addEventListener('click', function() {
+ var sel = getSelection();
+ sel.modify.apply(sel, commands.shift());
+ }, true);
+ </script>
+ */}, function(root) {
+ var input = root.find({role: RoleType.PARAGRAPH});
+ var move = input.doDefault.bind(input);
+
+ this.listenOnce(input, 'focus', function() {
+
+ // By character.
+ mockFeedback.call(move)
+ .expectSpeech('f', 'selected')
+ .expectBraille('first line\n', {startIndex: 0, endIndex: 1})
+ .call(move)
+ .expectSpeech('i', 'added to selection')
+ .expectBraille('first line\n', {startIndex: 0, endIndex: 2})
+
+ // Forward selection.
+
+ // Growing.
+
+ // By line (notice the partial selections from the first and second
+ // lines).
+ .call(move)
+ .expectSpeech('rst line \n se', 'selected')
+ .expectBraille('second line\n', {startIndex: 0, endIndex: 2})
+
+ .call(move)
+ .expectSpeech('cond line \n th', 'selected')
+ .expectBraille('third line\n', {startIndex: 0, endIndex: 2})
+
+ // Shrinking.
+ .call(move)
+ .expectSpeech('cond line \n th', 'unselected')
+ .expectBraille('second line\n', {startIndex: 0, endIndex: 2})
+
+ .call(move)
+ .expectSpeech('fi', 'selected')
+ .expectBraille('first line\n', {startIndex: 0, endIndex: 2})
+
+ // Document boundary.
+ .call(move)
+ .expectSpeech('rst line \n second line \n third line \n \n',
+ 'selected')
+ .expectBraille('third line\n', {startIndex: 0, endIndex: 10})
+
+ // The script repositions the caret to the 'n' of the third line.
+ .call(move)
+ .expectSpeech('third line')
+ .expectBraille('third line\n', {startIndex: 10, endIndex: 10})
+ .call(move)
+ .expectSpeech('e')
+ .expectBraille('third line\n', {startIndex: 9, endIndex: 9})
+ .call(move)
+ .expectSpeech('n')
+ .expectBraille('third line\n', {startIndex: 8, endIndex: 8})
+
+ // Backward selection.
+
+ // Growing.
+ .call(move)
+ .expectSpeech(' line \n third li', 'selected')
+ .expectBraille('second line\n', {startIndex: 6, endIndex: 12})
+
+ .call(move)
+ .expectSpeech('e \n second', 'selected')
+ .expectBraille('first line\n', {startIndex: 9, endIndex: 11})
+
+ // Shrinking.
+ .call(move)
+ .expectSpeech('e \n second', 'unselected')
+ .expectBraille('second line\n', {startIndex: 6, endIndex: 12})
+
+ .replay();
+ });
+ input.focus();
+ });
+});
+
TEST_F('EditingTest', 'EditableLineOneStaticText', function() {
this.runWithLoadedTree(function() {/*!
<p contenteditable style="word-spacing:100000px">this is a test</p>
@@ -573,8 +684,8 @@ TEST_F('EditingTest', 'EditableLineOneStaticText', function() {
assertEquals(0, e.startOffset);
assertEquals(0, e.endOffset);
- assertEquals(0, e.localStartOffset);
- assertEquals(0, e.localEndOffset);
+ assertEquals(5, e.localStartOffset);
+ assertEquals(5, e.localEndOffset);
assertEquals(0, e.containerStartOffset);
assertEquals(2, e.containerEndOffset);
@@ -584,8 +695,8 @@ TEST_F('EditingTest', 'EditableLineOneStaticText', function() {
assertEquals(2, e.startOffset);
assertEquals(2, e.endOffset);
- assertEquals(2, e.localStartOffset);
- assertEquals(2, e.localEndOffset);
+ assertEquals(7, e.localStartOffset);
+ assertEquals(7, e.localEndOffset);
assertEquals(0, e.containerStartOffset);
assertEquals(2, e.containerEndOffset);
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698