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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/walkers/table_walker_test.unitjs

Issue 563773003: Migrate walker tests from upstream ChromeVox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Finish walker tests. Created 6 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
(Empty)
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.
4
5 // Include test fixture.
6 GEN_INCLUDE(['walker_unittest_base.js']);
7
8 /**
9 * Test fixture.
10 * @constructor
11 * @extends {CvoxWalkerTestBase}
12 */
13 function CvoxTableWalkerUnitTest() {}
14
15 CvoxTableWalkerUnitTest.prototype = {
16 __proto__: CvoxWalkerUnitTestBase.prototype,
17
18 /** @override */
19 closureModuleDeps: CvoxWalkerUnitTestBase.prototype.closureModuleDeps.concat(
20 'cvox.TableWalker'),
21
22 /** @override */
23 newWalker: function() {
24 return new cvox.TableWalker();
25 }
26
27 };
28
29 // NOTE: The common walker tests don't work for the table walker, so they are
30 // not added here.
31
32 /**
33 * Simple tests for TableWalker
34 */
35 TEST_F('CvoxTableWalkerUnitTest', 'testSimpleTableWalker', function() {
36 this.loadDoc(function() {/*!
37 <p id="before">Before</p>
38 <table id="table">
39 <tr><td>A</td><td>1</td></tr>
40 <tr><td>B</td><td>2</td></tr>
41 </table>
42 */});
43 var node = document.getElementById('table');
44 var sel = cvox.CursorSelection.fromNode(node);
45 var ret = this.go(sel, 'sync', {descText: 'A'});
46 });
47
48 /**
49 * Test navigating rows.
50 */
51 TEST_F('CvoxTableWalkerUnitTest', 'testNavigateRows', function() {
52 this.loadDoc(function() {/*!
53 <table id="table">
54 <tr><td>A</td><td>1</td></tr>
55 <tr><td>B</td><td>2</td></tr>
56 </table>
57 */});
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);
66 });
67
68 /**
69 * Test navigating columns.
70 */
71 TEST_F('CvoxTableWalkerUnitTest', 'testNavigateCols', function() {
72 this.loadDoc(function() {/*!
73 <table id="table">
74 <tr><td>A</td><td>1</td></tr>
75 <tr><td>B</td><td>2</td></tr>
76 </table>
77 */});
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);
86 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698