Skip to content

Commit 5150114

Browse files
committed
test page init textarea autogrow
1 parent 8b1c284 commit 5150114

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

tests/unit/textinput/index.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<script src="../../../js/jquery.js"></script>
99
<script src="../jquery.setNameSpace.js"></script>
10+
<script src="../../jquery.testHelper.js"></script>
1011
<script src="../../../external/qunit.js"></script>
1112
<script src="../../../js/"></script>
1213
<link rel="stylesheet" href="../../../themes/default" />
@@ -26,7 +27,22 @@ <h2 id="qunit-userAgent"></h2>
2627

2728
<div data-nstest-role="page">
2829
<input name="" id="typeless-input" />
29-
<textarea class="should-be-native"/>
30+
<textarea class="should-be-native"></textarea>
31+
32+
<textarea id="reference-autogrow">
33+
</textarea>
34+
35+
<textarea id="init-autogrow">
36+
Place holder text
37+
Place holder text
38+
Place holder text
39+
Place holder text
40+
Place holder text
41+
Place holder text
42+
Place holder text
43+
Place holder text
44+
Place holder text
45+
</textarea>
3046
</div>
3147
</body>
3248
</html>

tests/unit/textinput/textinput_core.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,18 @@
1010

1111
$.mobile.page.prototype.options.keepNative = "textarea.should-be-native";
1212

13-
// not testing the positive case here since's it's obviously tested elsewhere
13+
// not testing the positive case here since's it's obviously tested elsewhere
1414
test( "textarea in the keepNative set shouldn't be enhanced", function() {
15-
ok( !$("textarea.should-be-native").is("ui-input-text") );
15+
ok( !$("textarea.should-be-native").is("ui-input-text") );
16+
});
17+
18+
asyncTest( "textarea should autogrow on document ready", function() {
19+
var test = $( "#init-autogrow" );
20+
21+
setTimeout(function() {
22+
ok( $( "#reference-autogrow" )[0].clientHeight < test[0].clientHeight, "the height is greater than the reference text area with no content" );
23+
ok( test[0].clientHeight > 100, "autogrow text area's height is greater than any style padding");
24+
start();
25+
}, 400);
1626
});
1727
})(jQuery);

0 commit comments

Comments
 (0)