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 CvoxWordWalkerUnitTest() {}
15 CvoxWordWalkerUnitTest.prototype = {
16 __proto__: CvoxWalkerUnitTestBase.prototype,
19 closureModuleDeps: CvoxWalkerUnitTestBase.prototype.closureModuleDeps.concat(
23 newWalker: function() {
24 return new cvox.WordWalker();
28 * Set up for the simple tests so we don't have to repeat.
31 setUpSimpleHtml_: function() {
32 this.loadDoc(function() {/*!
33 <div id="a"><p id="b">The </p><p id="c">quick brown.</p></div>
38 CvoxWalkerUnitTestBase.addCommonTests('CvoxWordWalkerUnitTest');
40 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleForwardSync', function() {
41 this.setUpSimpleHtml_();
44 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
45 var ret = this.go(sel, 'sync', {
54 var ret2 = this.walker.sync(ret);
55 assertTrue(ret2.equals(ret));
58 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleReversedSync', function() {
59 this.setUpSimpleHtml_();
62 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
63 sel.setReversed(true);
64 var ret = this.go(sel, 'sync', {
65 selText: 'quick brown.',
73 var ret2 = this.walker.sync(ret);
74 assertTrue(ret2.equals(ret));
77 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleForwardNext', function() {
78 this.setUpSimpleHtml_();
80 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
81 sel = this.walker.sync(sel);
82 var ret = this.go(sel, 'next', {
83 selText: 'quick brown.',
91 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleReversedNext', function() {
92 this.setUpSimpleHtml_();
94 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
95 sel = this.walker.sync(sel.setReversed(true));
96 var ret = this.go(sel, 'next', {