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

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

Issue 2195343003: Support navigation within editable nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. 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
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 TEST_F('CursorsTest', 'MultiLineOffsetSelection', function() { 366 TEST_F('CursorsTest', 'MultiLineOffsetSelection', function() {
367 this.runWithLoadedTree(this.multiInlineDoc, function(root) { 367 this.runWithLoadedTree(this.multiInlineDoc, function(root) {
368 var secondLine = root.firstChild.firstChild.firstChild.nextSibling; 368 var secondLine = root.firstChild.firstChild.firstChild.nextSibling;
369 assertEquals('inlineTextBox', secondLine.role); 369 assertEquals('inlineTextBox', secondLine.role);
370 assertEquals('diff ', secondLine.name); 370 assertEquals('diff ', secondLine.name);
371 371
372 var secondLineCursor = new cursors.Cursor(secondLine, -1); 372 var secondLineCursor = new cursors.Cursor(secondLine, -1);
373 // The selected node moves to the static text node. 373 // The selected node moves to the static text node.
374 assertEquals(secondLineCursor.node.parent, 374 assertEquals(secondLineCursor.node.parent,
375 secondLineCursor.selectionNode_); 375 secondLineCursor.selectionNode_);
376
376 // This selects the entire node via a character offset. 377 // This selects the entire node via a character offset.
377 assertEquals(6, secondLineCursor.selectionIndex_); 378 assertEquals(6, secondLineCursor.selectionIndex_);
378 379
379 // Index into the characters. 380 // Index into the characters.
380 secondLineCursor = new cursors.Cursor(secondLine, 1); 381 secondLineCursor = new cursors.Cursor(secondLine, 1);
381 assertEquals(7, secondLineCursor.selectionIndex_); 382 assertEquals(7, secondLineCursor.selectionIndex_);
382 383
383 // Now, try selecting via node offsets. 384 // Now, try selecting via node offsets. This defaults to index 0 and not
385 // index in parent because Blink accessibility selection doesn't always
386 // work.
384 var cursor = new cursors.Cursor(root.firstChild, -1); 387 var cursor = new cursors.Cursor(root.firstChild, -1);
385 assertEquals(root, cursor.selectionNode_); 388 assertEquals(root.firstChild, cursor.selectionNode_);
386 assertEquals(0, cursor.selectionIndex_); 389 assertEquals(0, cursor.selectionIndex_);
387 390
388 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1); 391 cursor = new cursors.Cursor(root.firstChild.nextSibling, -1);
389 assertEquals(root, cursor.selectionNode_); 392 assertEquals(root.firstChild.nextSibling, cursor.selectionNode_);
390 assertEquals(1, cursor.selectionIndex_); 393 assertEquals(0, cursor.selectionIndex_);
391 }); 394 });
392 }); 395 });
393 396
394 TEST_F('CursorsTest', 'InlineElementOffset', function() { 397 TEST_F('CursorsTest', 'InlineElementOffset', function() {
395 this.runWithLoadedTree(function() {/*! 398 this.runWithLoadedTree(function() {/*!
396 <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>
397 */}, function(root) { 400 */}, function(root) {
398 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { 401 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) {
399 // 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.
400 assertEquals(testNode, root.anchorObject); 403 assertEquals(testNode, root.anchorObject);
(...skipping 15 matching lines...) Expand all
416 419
417 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); 420 var curIntoO = new cursors.Cursor(ofSelectionNode, 1);
418 assertEquals('of selection', curIntoO.selectionNode_.name); 421 assertEquals('of selection', curIntoO.selectionNode_.name);
419 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); 422 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role);
420 assertEquals(1, curIntoO.selectionIndex_); 423 assertEquals(1, curIntoO.selectionIndex_);
421 424
422 var oRange = new cursors.Range(cur, curIntoO); 425 var oRange = new cursors.Range(cur, curIntoO);
423 oRange.select(); 426 oRange.select();
424 }); 427 });
425 }); 428 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698