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
51 * Test disabled due to not being reliable if font size changes.
52 * See https://codereview.chromium.org/549303004/
54 TEST_F('CvoxShadowUnitTest', 'DISABLED_MultilineWrap', function() {
55 this.loadDoc(function() {/*!
56 <div><textarea id="area"
57 cols=4 rows=20>One two thr fou fiv six sev eig</textarea>
62 var shadow = new cvox.EditableTextAreaShadow();
64 for (var i = 0; i < 32; i++) {
65 assertEquals(Math.floor(i / 4), shadow.getLineIndex(i));