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 CvoxSentenceWalkerUnitTest() {}
15 CvoxSentenceWalkerUnitTest.prototype = {
16 __proto__: CvoxWalkerUnitTestBase.prototype,
19 closureModuleDeps: CvoxWalkerUnitTestBase.prototype.closureModuleDeps.concat(
20 'cvox.SentenceWalker'),
23 newWalker: function() {
24 return new cvox.SentenceWalker();
31 setUpSimpleHtml_: function() {
32 this.loadDoc(function() {/*!
33 <div id="a"><p id="b">The quick</p><p id="c">brown. fox.</p></div>
38 CvoxWalkerUnitTestBase.addCommonTests('CvoxSentenceWalkerUnitTest');
40 TEST_F('CvoxSentenceWalkerUnitTest', 'testSimpleForwardSync', function() {
41 this.setUpSimpleHtml_();
43 var sel = cvox.CursorSelection.fromNode($('a'));
44 var ret = this.go(sel, 'sync', {
53 var ret2 = this.walker.sync(ret);
54 assertTrue(ret2.equals(ret));
57 TEST_F('CvoxSentenceWalkerUnitTest', 'testSimpleReversedSync', function() {
58 this.setUpSimpleHtml_();
60 var sel = cvox.CursorSelection.fromNode($('a'));
61 sel.setReversed(true);
62 var ret = this.go(sel, 'sync', {
63 selText: 'brown. fox.',
71 var ret2 = this.walker.sync(ret);
72 assertTrue(ret2.equals(ret));
75 TEST_F('CvoxSentenceWalkerUnitTest', 'testSimpleForwardNext', function() {
76 this.setUpSimpleHtml_();
78 var sel = cvox.CursorSelection.fromNode($('a'));
79 sel = this.walker.sync(sel);
80 var ret = this.go(sel, 'next', {
81 selText: 'brown. fox.',
89 TEST_F('CvoxSentenceWalkerUnitTest', 'testSimpleReversedNext', function() {
90 this.setUpSimpleHtml_();
92 var sel = cvox.CursorSelection.fromNode($('a'));
93 sel = this.walker.sync(sel.setReversed(true));
94 var ret = this.go(sel, 'next', {
101 ret = this.go(ret, 'next', null);
104 TEST_F('CvoxSentenceWalkerUnitTest', 'testControlElements', function() {
105 this.loadDoc(function() {/*!
106 <div id="a"><p>Before</p><input type="text"/><p>After</p></div>
109 var sel = this.walker.sync(cvox.CursorSelection.fromNode(node));
110 var ret = this.go(sel, 'next', {descAnnotation: 'Edit text'});