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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/editable_text_area_shadow_test.js

Issue 298653011: More ChromeVox tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style violations Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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(['../testing/chromevox_unittest_base.js']);
7
8 /**
9 * Test fixture.
10 * @constructor
11 * @extends {ChromeVoxUnitTestBase}
12 */
13 function CvoxShadowUnitTest() {}
14
15 CvoxShadowUnitTest.prototype = {
16 __proto__: ChromeVoxUnitTestBase.prototype,
17
18 /** @override */
19 closureModuleDeps: [
20 'cvox.EditableTextAreaShadow'
21 ]
22 };
23
24 TEST_F('CvoxShadowUnitTest', 'MultilineLines', function() {
25 this.loadDoc(function() {/*!
26 <div><textarea id="area">
27 one
28
29 two
30
31 three
32 </textarea></div> */});
33
34 var area = $('area');
35
36 var shadow = new cvox.EditableTextAreaShadow();
37 shadow.update(area);
38 assertEquals(0, shadow.getLineIndex(0));
39 assertEquals(0, shadow.getLineIndex(3));
40 assertEquals(1, shadow.getLineIndex(4));
41 assertEquals(2, shadow.getLineIndex(5));
42 assertEquals(2, shadow.getLineIndex(8));
43 assertEquals(3, shadow.getLineIndex(9));
44 assertEquals(4, shadow.getLineIndex(10));
45 assertEquals(4, shadow.getLineIndex(14));
46 });
47
48 /**
49 * Test the get line of a multiline textarea with wrapping instead of
50 * explicit newlines.
51 * @export
52 */
53 TEST_F('CvoxShadowUnitTest', 'MultilineWrap', function() {
54 this.loadDoc(function() {/*!
55 <div><textarea id="area"
56 cols=4 rows=20>One two thr fou fiv six sev eig</textarea>
57 </div> */});
58
59 var area = $('area');
60
61 var shadow = new cvox.EditableTextAreaShadow();
62 shadow.update(area);
63 for (var i = 0; i < 32; i++) {
64 assertEquals(Math.floor(i / 4), shadow.getLineIndex(i));
65 }
66 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698