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
3 // found in the LICENSE file.
5 // Include test fixture.
6 GEN_INCLUDE(['walker_unittest_base.js']);
11 * @extends {CvoxWalkerTestBase}
13 function CvoxTableWalkerUnitTest() {}
15 CvoxTableWalkerUnitTest.prototype = {
16 __proto__: CvoxWalkerUnitTestBase.prototype,
19 closureModuleDeps: CvoxWalkerUnitTestBase.prototype.closureModuleDeps.concat(
23 newWalker: function() {
24 return new cvox.TableWalker();
29 // NOTE: The common walker tests don't work for the table walker, so they are
33 * Simple tests for TableWalker
35 TEST_F('CvoxTableWalkerUnitTest', 'testSimpleTableWalker', function() {
36 this.loadDoc(function() {/*!
37 <p id="before">Before</p>
39 <tr><td>A</td><td>1</td></tr>
40 <tr><td>B</td><td>2</td></tr>
43 var node = document.getElementById('table');
44 var sel = cvox.CursorSelection.fromNode(node);
45 var ret = this.go(sel, 'sync', {descText: 'A'});
49 * Test navigating rows.
51 TEST_F('CvoxTableWalkerUnitTest', 'testNavigateRows', function() {
52 this.loadDoc(function() {/*!
54 <tr><td>A</td><td>1</td></tr>
55 <tr><td>B</td><td>2</td></tr>
58 var node = document.getElementById('table');
59 var sel = cvox.CursorSelection.fromNode(node);
60 var ret = this.go(sel, 'sync', {descText: 'A'});
61 ret = this.go(ret, 'nextRow', {descText: 'B'});
62 this.go(ret, 'nextRow', null);
63 ret.setReversed(true);
64 ret = this.go(ret, 'nextRow', {descText: 'A'});
65 this.go(ret, 'nextRow', null);
69 * Test navigating columns.
71 TEST_F('CvoxTableWalkerUnitTest', 'testNavigateCols', function() {
72 this.loadDoc(function() {/*!
74 <tr><td>A</td><td>1</td></tr>
75 <tr><td>B</td><td>2</td></tr>
78 var node = document.getElementById('table');
79 var sel = cvox.CursorSelection.fromNode(node);
80 var ret = this.go(sel, 'sync', {descText: 'A'});
81 ret = this.go(ret, 'nextCol', {descText: '1'});
82 this.go(ret, 'nextCol', null);
83 ret.setReversed(true);
84 ret = this.go(ret, 'nextCol', {descText: 'A'});
85 this.go(ret, 'nextCol', null);