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

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

Issue 1949373003: Change Range.getBoundingClientRect() when the first rect is empty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test as per eae review Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/Range/get-bounding-client-rect-empty-and-non-empty.html » ('j') | 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 * Test fixture. 9 * Test fixture.
10 * @constructor 10 * @constructor
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 <div> 190 <div>
191 <div id="textbox" 191 <div id="textbox"
192 style="width: 1em; word-wrap: normal" 192 style="width: 1em; word-wrap: normal"
193 contentEditable="true">One two three</div> 193 contentEditable="true">One two three</div>
194 </div> 194 </div>
195 */}); 195 */});
196 var textbox = $('textbox'); 196 var textbox = $('textbox');
197 197
198 var extractor = new cvox.ContentEditableExtractor(); 198 var extractor = new cvox.ContentEditableExtractor();
199 extractor.update(textbox); 199 extractor.update(textbox);
200 assertEquals('One two three', extractor.getText()); 200 assertEquals('One\ntwo\nthree', extractor.getText());
201 assertEquals(0, extractor.getLineStart(0)); 201 assertEquals(0, extractor.getLineStart(0));
202 assertEquals(3, extractor.getLineEnd(0)); 202 assertEquals(4, extractor.getLineEnd(0));
203 assertEquals(3, extractor.getLineStart(1)); 203 assertEquals(4, extractor.getLineStart(1));
204 assertEquals(7, extractor.getLineEnd(1)); 204 assertEquals(8, extractor.getLineEnd(1));
205 assertEquals(7, extractor.getLineStart(2)); 205 assertEquals(8, extractor.getLineStart(2));
206 assertEquals(13, extractor.getLineEnd(2)); 206 assertEquals(13, extractor.getLineEnd(2));
207 207
208 // Test all possible cursor positions. 208 // Test all possible cursor positions.
209 for (var i = 0; i <= 13; i++) { 209 for (var i = 0; i <= 13; i++) {
210 setSelection(textbox.firstChild, i, textbox.firstChild, i); 210 setSelection(textbox.firstChild, i, textbox.firstChild, i);
211 extractor.update(textbox); 211 extractor.update(textbox);
212 assertEquals(i, extractor.getStartIndex()); 212 assertEquals(i, extractor.getStartIndex());
213 assertEquals(i, extractor.getEndIndex()); 213 assertEquals(i, extractor.getEndIndex());
214 } 214 }
215 }); 215 });
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 extractor.update(textbox); 317 extractor.update(textbox);
318 assertEquals(7, extractor.getStartIndex()); 318 assertEquals(7, extractor.getStartIndex());
319 assertEquals(7, extractor.getEndIndex()); 319 assertEquals(7, extractor.getEndIndex());
320 320
321 // Beginning of third line. 321 // Beginning of third line.
322 setSelection(threeTextNode, 0, threeTextNode, 0); 322 setSelection(threeTextNode, 0, threeTextNode, 0);
323 extractor.update(textbox); 323 extractor.update(textbox);
324 assertEquals(8, extractor.getStartIndex()); 324 assertEquals(8, extractor.getStartIndex());
325 assertEquals(8, extractor.getEndIndex()); 325 assertEquals(8, extractor.getEndIndex());
326 }); 326 });
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/Range/get-bounding-client-rect-empty-and-non-empty.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698