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_unittest_base.js']); | 6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); |
7 | 7 |
8 /** | 8 /** |
9 * Test fixture. | 9 * Test fixture. |
10 * @constructor | 10 * @constructor |
11 * @extends {ChromeVoxUnitTestBase} | 11 * @extends {ChromeVoxUnitTestBase} |
12 */ | 12 */ |
13 function CvoxLayoutLineWalkerUnitTest() {} | 13 function CvoxLayoutLineWalkerUnitTest() {} |
14 | 14 |
15 CvoxLayoutLineWalkerUnitTest.prototype = { | 15 CvoxLayoutLineWalkerUnitTest.prototype = { |
16 __proto__: ChromeVoxUnitTestBase.prototype, | 16 __proto__: ChromeVoxUnitTestBase.prototype, |
17 | 17 |
18 /** @override */ | 18 /** @override */ |
19 closureModuleDeps: [ | 19 closureModuleDeps: [ |
| 20 'TestMsgs', |
20 'cvox.CursorSelection', | 21 'cvox.CursorSelection', |
21 'cvox.LayoutLineWalker', | 22 'cvox.LayoutLineWalker', |
22 'cvox.TestMsgs', | |
23 ], | 23 ], |
24 | 24 |
25 /** @override */ | 25 /** @override */ |
26 setUp: function() { | 26 setUp: function() { |
27 this.loadHtml( | 27 this.loadHtml( |
28 '<div id="1">' + | 28 '<div id="1">' + |
29 '<p id="a">Demonstrating that in-line links like ' + | 29 '<p id="a">Demonstrating that in-line links like ' + |
30 '<a id="aa" href="google.com">google</a> ' + | 30 '<a id="aa" href="google.com">google</a> ' + |
31 'are considered a single layout line.' + | 31 'are considered a single layout line.' + |
32 '</p>' + | 32 '</p>' + |
33 '<p id="b">' + | 33 '<p id="b">' + |
34 'This includes a paragraph that has a lot of text like this one. ' + | 34 'This includes a paragraph that has a lot of text like this one. ' + |
35 '<a id="bb" href="wikipedia.com">Wikipedia</a> ' + | 35 '<a id="bb" href="wikipedia.com">Wikipedia</a> ' + |
36 'is a great example of a site that this walker becomes valuable.<br>' + | 36 'is a great example of a site that this walker becomes valuable.<br>' + |
37 'Braille also benefits greatly from this type of formatting since ' + | 37 'Braille also benefits greatly from this type of formatting since ' + |
38 'some displays can handle lots of text like 80 cell displays!' + | 38 'some displays can handle lots of text like 80 cell displays!' + |
39 '</p>' + | 39 '</p>' + |
40 '</div>' | 40 '</div>' |
41 ); | 41 ); |
42 cvox.ChromeVox.msgs = new cvox.TestMsgs(); | 42 Msgs = TestMsgs; |
43 this.walker = new cvox.LayoutLineWalker(); | 43 this.walker = new cvox.LayoutLineWalker(); |
44 | 44 |
45 this.a = cvox.CursorSelection.fromNode($('a')); | 45 this.a = cvox.CursorSelection.fromNode($('a')); |
46 this.aa = cvox.CursorSelection.fromNode($('aa')); | 46 this.aa = cvox.CursorSelection.fromNode($('aa')); |
47 this.b = cvox.CursorSelection.fromNode($('b')); | 47 this.b = cvox.CursorSelection.fromNode($('b')); |
48 this.bb = cvox.CursorSelection.fromNode($('bb')); | 48 this.bb = cvox.CursorSelection.fromNode($('bb')); |
49 | 49 |
50 this.line1Text = 'Demonstrating that in-line links like google are' + | 50 this.line1Text = 'Demonstrating that in-line links like google are' + |
51 ' considered a single layout line.'; | 51 ' considered a single layout line.'; |
52 | 52 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 // First line. | 171 // First line. |
172 sel = this.walker.next(sel); | 172 sel = this.walker.next(sel); |
173 assertEquals(this.line1Text, sel.getText()); | 173 assertEquals(this.line1Text, sel.getText()); |
174 | 174 |
175 // Wrap. | 175 // Wrap. |
176 sel.setReversed(true); | 176 sel.setReversed(true); |
177 sel = this.walker.next(sel); | 177 sel = this.walker.next(sel); |
178 assertEquals(null, sel); | 178 assertEquals(null, sel); |
179 }); | 179 }); |
OLD | NEW |