Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 assertEquals(1, cursor.selectionIndex_); | 390 assertEquals(1, cursor.selectionIndex_); |
| 391 }); | 391 }); |
| 392 }); | 392 }); |
| 393 | 393 |
| 394 TEST_F('CursorsTest', 'InlineElementOffset', function() { | 394 TEST_F('CursorsTest', 'InlineElementOffset', function() { |
| 395 this.runWithLoadedTree(function() {/*! | 395 this.runWithLoadedTree(function() {/*! |
| 396 <p>This<br> is a<a href="#g">test</a>of selection</p> | 396 <p>This<br> is a<a href="#g">test</a>of selection</p> |
| 397 */}, function(root) { | 397 */}, function(root) { |
| 398 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { | 398 root.addEventListener('textSelectionChanged', this.newCallback(function(evt) { |
| 399 // This is a little unexpected though not really incorrect; Ctrl+C works. | 399 // This is a little unexpected though not really incorrect; Ctrl+C works. |
| 400 assertEquals(testNode, root.anchorObject); | 400 assertEquals(testNode, root.anchorObject); |
|
David Tseng
2016/08/18 22:18:39
FYI; this is still wrong.
| |
| 401 assertEquals(ofSelectionNode, root.focusObject); | 401 assertEquals(ofSelectionNode, root.focusObject); |
| 402 assertEquals(4, root.anchorOffset); | 402 assertEquals(4, root.anchorOffset); |
|
David Tseng
2016/08/18 22:18:39
As is this. The selection is on the ofSelection no
| |
| 403 assertEquals(1, root.focusOffset); | 403 assertEquals(1, root.focusOffset); |
| 404 })); | 404 })); |
| 405 | 405 |
| 406 // This is the link's static text. | 406 // This is the link's static text. |
| 407 var testNode = root.lastChild.lastChild.previousSibling.firstChild; | 407 var testNode = root.lastChild.lastChild.previousSibling.firstChild; |
| 408 assertEquals(RoleType.staticText, testNode.role); | 408 assertEquals(RoleType.staticText, testNode.role); |
| 409 assertEquals('test', testNode.name); | 409 assertEquals('test', testNode.name); |
| 410 | 410 |
| 411 var ofSelectionNode = root.lastChild.lastChild; | 411 var ofSelectionNode = root.lastChild.lastChild; |
| 412 var cur = new cursors.Cursor(ofSelectionNode, 0); | 412 var cur = new cursors.Cursor(ofSelectionNode, 0); |
| 413 assertEquals('of selection', cur.selectionNode_.name); | 413 assertEquals('of selection', cur.selectionNode_.name); |
| 414 assertEquals(RoleType.staticText, cur.selectionNode_.role); | 414 assertEquals(RoleType.staticText, cur.selectionNode_.role); |
| 415 assertEquals(13, cur.selectionIndex_); | 415 assertEquals(0, cur.selectionIndex_); |
| 416 | 416 |
| 417 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); | 417 var curIntoO = new cursors.Cursor(ofSelectionNode, 1); |
| 418 assertEquals('of selection', curIntoO.selectionNode_.name); | 418 assertEquals('of selection', curIntoO.selectionNode_.name); |
| 419 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); | 419 assertEquals(RoleType.staticText, curIntoO.selectionNode_.role); |
| 420 assertEquals(14, curIntoO.selectionIndex_); | 420 assertEquals(1, curIntoO.selectionIndex_); |
| 421 | 421 |
| 422 var oRange = new cursors.Range(cur, curIntoO); | 422 var oRange = new cursors.Range(cur, curIntoO); |
| 423 oRange.select(); | 423 oRange.select(); |
| 424 }); | 424 }); |
| 425 }); | 425 }); |
| OLD | NEW |