| 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);
|
|
|