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

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

Issue 2263513004: Add support for rich output inside of content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@editable_nav
Patch Set: Test fixes. 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. This defaults to index 0 and not 384 // Now, try selecting via node offsets.
385 // index in parent because Blink accessibility selection doesn't always 385 // Slightly different than DOM selections (1-based index).
386 // work.
387 var cursor = new cursors.Cursor(root.firstChild, -1); 386 var cursor = new cursors.Cursor(root.firstChild, -1);
388 assertEquals(root.firstChild, cursor.selectionNode_); 387 assertEquals(root, cursor.selectionNode_);
389 assertEquals(0, cursor.selectionIndex_); 388 assertEquals(1, cursor.selectionIndex_);
390 389
391 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1); 390 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1);
392 assertEquals(root.firstChild.nextSibling, cursor.selectionNode_); 391 assertEquals(root, cursor.selectionNode_);
393 assertEquals(0, cursor.selectionIndex_); 392 assertEquals(2, cursor.selectionIndex_);
394 }); 393 });
395 }); 394 });
396 395
397 TEST_F('CursorsTest', 'InlineElementOffset', function() { 396 TEST_F('CursorsTest', 'InlineElementOffset', function() {
398 this.runWithLoadedTree(function() {/*! 397 this.runWithLoadedTree(function() {/*!
399 <p>This<br> is a<a href="#g">test</a>of selection</p> 398 <p>This<br> is a<a href="#g">test</a>of selection</p>
400 */}, function(root) { 399 */}, function(root) {
401 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { 400 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) {
402 // This is a little unexpected though not really incorrect; Ctrl+C works. 401 // This is a little unexpected though not really incorrect; Ctrl+C works.
403 assertEquals(testNode, root.anchorObject); 402 assertEquals(testNode, root.anchorObject);
(...skipping 15 matching lines...) Expand all
419 418
420 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); 419 var curIntoO = new cursors.Cursor(ofSelectionNode, 1);
421 assertEquals('of selection', curIntoO.selectionNode_.name); 420 assertEquals('of selection', curIntoO.selectionNode_.name);
422 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); 421 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role);
423 assertEquals(1, curIntoO.selectionIndex_); 422 assertEquals(1, curIntoO.selectionIndex_);
424 423
425 var oRange = new cursors.Range(cur, curIntoO); 424 var oRange = new cursors.Range(cur, curIntoO);
426 oRange.select(); 425 oRange.select();
427 }); 426 });
428 }); 427 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698