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(['../testing/chromevox_unittest_base.js']);
11 * @extends {ChromeVoxUnitTestBase}
13 function CvoxShadowUnitTest() {}
15 CvoxShadowUnitTest.prototype = {
16 __proto__: ChromeVoxUnitTestBase.prototype,
20 'cvox.EditableTextAreaShadow'
24 TEST_F('CvoxShadowUnitTest', 'MultilineLines', function() {
25 this.loadDoc(function() {/*!
26 <div><textarea id="area">
32 </textarea></div> */});
36 var shadow = new cvox.EditableTextAreaShadow();
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));
49 * Test the get line of a multiline textarea with wrapping instead of
52 TEST_F('CvoxShadowUnitTest', 'MultilineWrap', function() {
53 this.loadDoc(function() {/*!
54 <div><textarea id="area"
55 cols=4 rows=20>One two thr fou fiv six sev eig</textarea>
60 var shadow = new cvox.EditableTextAreaShadow();
62 for (var i = 0; i < 32; i++) {
63 assertEquals(Math.floor(i / 4), shadow.getLineIndex(i));