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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/editable_text_test.unitjs

Issue 2104473003: Support Windows/Linux-style forward delete feedback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: m Created 4 years, 4 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/editable_text_base.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_unittest_base.js']); 6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']);
7 7
8 /** 8 /**
9 * A TTS class implementing speak and stop methods intended only for testing. 9 * A TTS class implementing speak and stop methods intended only for testing.
10 * @constructor 10 * @constructor
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 'W', 'o', 'r', 'l', 'd', 'World.'], 213 'W', 'o', 'r', 'l', 'd', 'World.'],
214 tts.get()); 214 tts.get());
215 215
216 // Backspace 216 // Backspace
217 obj.changed(new cvox.TextChangeEvent('Hello, World', 12, 12)); 217 obj.changed(new cvox.TextChangeEvent('Hello, World', 12, 12));
218 obj.changed(new cvox.TextChangeEvent('Hello, Worl', 11, 11)); 218 obj.changed(new cvox.TextChangeEvent('Hello, Worl', 11, 11));
219 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 10, 10)); 219 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 10, 10));
220 assertEqualStringArrays(['.', 'd', 'l'], tts.get()); 220 assertEqualStringArrays(['.', 'd', 'l'], tts.get());
221 221
222 // Forward-delete 222 // Forward-delete
223 cvox.ChromeVoxEditableTextBase.useIBeamCursor = true;
223 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 9, 9)); 224 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 9, 9));
224 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 8, 8)); 225 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 8, 8));
225 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 7, 7)); 226 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 7, 7));
226 obj.changed(new cvox.TextChangeEvent('Hello, or', 7, 7)); 227 obj.changed(new cvox.TextChangeEvent('Hello, or', 7, 7));
227 obj.changed(new cvox.TextChangeEvent('Hello, r', 7, 7)); 228 obj.changed(new cvox.TextChangeEvent('Hello, r', 7, 7));
228 obj.changed(new cvox.TextChangeEvent('Hello, ', 7, 7)); 229 obj.changed(new cvox.TextChangeEvent('Hello, ', 7, 7));
229 assertEqualStringArrays(['r', 'o', 'W', 'W', 'o', 'r'], tts.get()); 230 assertEqualStringArrays(['r', 'o', 'W', 'W', 'o', 'r'], tts.get());
230 231
232 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 10, 10));
233 cvox.ChromeVoxEditableTextBase.useIBeamCursor = false;
234 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 9, 9));
235 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 8, 8));
236 obj.changed(new cvox.TextChangeEvent('Hello, Wor', 7, 7));
237 obj.changed(new cvox.TextChangeEvent('Hello, or', 7, 7));
238 obj.changed(new cvox.TextChangeEvent('Hello, r', 7, 7));
239 obj.changed(new cvox.TextChangeEvent('Hello, ', 7, 7));
240 assertEqualStringArrays(['Wor', 'r', 'o', 'W', 'o', 'r'], tts.get());
241
231 // Clear all 242 // Clear all
232 obj.changed(new cvox.TextChangeEvent('', 0, 0)); 243 obj.changed(new cvox.TextChangeEvent('', 0, 0));
233 assertEqualStringArrays(['Hello, , deleted'], tts.get()); 244 assertEqualStringArrays(['Hello, , deleted'], tts.get());
234 245
235 // Paste / insert a whole word 246 // Paste / insert a whole word
236 obj.changed(new cvox.TextChangeEvent('Hello', 5, 5)); 247 obj.changed(new cvox.TextChangeEvent('Hello', 5, 5));
237 assertEqualStringArrays(['Hello'], tts.get()); 248 assertEqualStringArrays(['Hello'], tts.get());
238 obj.changed(new cvox.TextChangeEvent('Hello, World', 12, 12)); 249 obj.changed(new cvox.TextChangeEvent('Hello, World', 12, 12));
239 assertEqualStringArrays([', World'], tts.get()); 250 assertEqualStringArrays([', World'], tts.get());
240 }); 251 });
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 var firstLine = 'Some text.\n'; 695 var firstLine = 'Some text.\n';
685 for (var i = 0; i < firstLine.length; ++i) { 696 for (var i = 0; i < firstLine.length; ++i) {
686 editable.update(true); 697 editable.update(true);
687 TestBraille.assertContent(firstLine, i, i); 698 TestBraille.assertContent(firstLine, i, i);
688 window.getSelection().modify('move', 'forward', 'character'); 699 window.getSelection().modify('move', 'forward', 'character');
689 } 700 }
690 // We should have crossed the line break to the second line which is blank. 701 // We should have crossed the line break to the second line which is blank.
691 editable.update(true); 702 editable.update(true);
692 TestBraille.assertContent('', 0, 0); 703 TestBraille.assertContent('', 0, 0);
693 }); 704 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/common/editable_text_base.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698