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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs

Issue 2312353002: Revert of Add support for rich output inside of content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@editable_nav
Patch Set: Created 4 years, 3 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
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_next_e2e_test_base.js']); 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']);
7 7
8 /** 8 /**
9 * Test fixture for cvox2.cursors. 9 * Test fixture for cvox2.cursors.
10 * @constructor 10 * @constructor
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 assertEquals(secondLineCursor.node.parent, 374 assertEquals(secondLineCursor.node.parent,
375 secondLineCursor.selectionNode_); 375 secondLineCursor.selectionNode_);
376 376
377 // This selects the entire node via a character offset. 377 // This selects the entire node via a character offset.
378 assertEquals(6, secondLineCursor.selectionIndex_); 378 assertEquals(6, secondLineCursor.selectionIndex_);
379 379
380 // Index into the characters. 380 // Index into the characters.
381 secondLineCursor = new cursors.Cursor(secondLine, 1); 381 secondLineCursor = new cursors.Cursor(secondLine, 1);
382 assertEquals(7, secondLineCursor.selectionIndex_); 382 assertEquals(7, secondLineCursor.selectionIndex_);
383 383
384 // Now, try selecting via node offsets. 384 // Now, try selecting via node offsets. This defaults to index 0 and not
385 // Slightly different than DOM selections (1-based index). 385 // index in parent because Blink accessibility selection doesn't always
386 // work.
386 var cursor = new cursors.Cursor(root.firstChild, -1); 387 var cursor = new cursors.Cursor(root.firstChild, -1);
387 assertEquals(root, cursor.selectionNode_); 388 assertEquals(root.firstChild, cursor.selectionNode_);
388 assertEquals(1, cursor.selectionIndex_); 389 assertEquals(0, cursor.selectionIndex_);
389 390
390 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1); 391 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1);
391 assertEquals(root, cursor.selectionNode_); 392 assertEquals(root.firstChild.nextSibling, cursor.selectionNode_);
392 assertEquals(2, cursor.selectionIndex_); 393 assertEquals(0, cursor.selectionIndex_);
393 }); 394 });
394 }); 395 });
395 396
396 TEST_F('CursorsTest', 'InlineElementOffset', function() { 397 TEST_F('CursorsTest', 'InlineElementOffset', function() {
397 this.runWithLoadedTree(function() {/*! 398 this.runWithLoadedTree(function() {/*!
398 <p>This<br> is a<a href="#g">test</a>of selection</p> 399 <p>This<br> is a<a href="#g">test</a>of selection</p>
399 */}, function(root) { 400 */}, function(root) {
400 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { 401 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) {
401 // This is a little unexpected though not really incorrect; Ctrl+C works. 402 // This is a little unexpected though not really incorrect; Ctrl+C works.
402 assertEquals(testNode, root.anchorObject); 403 assertEquals(testNode, root.anchorObject);
(...skipping 15 matching lines...) Expand all
418 419
419 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); 420 var curIntoO = new cursors.Cursor(ofSelectionNode, 1);
420 assertEquals('of selection', curIntoO.selectionNode_.name); 421 assertEquals('of selection', curIntoO.selectionNode_.name);
421 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); 422 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role);
422 assertEquals(1, curIntoO.selectionIndex_); 423 assertEquals(1, curIntoO.selectionIndex_);
423 424
424 var oRange = new cursors.Range(cur, curIntoO); 425 var oRange = new cursors.Range(cur, curIntoO);
425 oRange.select(); 426 oRange.select();
426 }); 427 });
427 }); 428 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698