test page init textarea autogrow

This commit is contained in:
John Bender 2011-10-11 11:25:28 -07:00
parent 8b1c28439c
commit 5150114c13
2 changed files with 29 additions and 3 deletions

View file

@ -7,6 +7,7 @@
<script src="../../../js/jquery.js"></script>
<script src="../jquery.setNameSpace.js"></script>
<script src="../../jquery.testHelper.js"></script>
<script src="../../../external/qunit.js"></script>
<script src="../../../js/"></script>
<link rel="stylesheet" href="../../../themes/default" />
@ -26,7 +27,22 @@
<div data-nstest-role="page">
<input name="" id="typeless-input" />
<textarea class="should-be-native"/>
<textarea class="should-be-native"></textarea>
<textarea id="reference-autogrow">
</textarea>
<textarea id="init-autogrow">
Place holder text
Place holder text
Place holder text
Place holder text
Place holder text
Place holder text
Place holder text
Place holder text
Place holder text
</textarea>
</div>
</body>
</html>

View file

@ -10,8 +10,18 @@
$.mobile.page.prototype.options.keepNative = "textarea.should-be-native";
// not testing the positive case here since's it's obviously tested elsewhere
// not testing the positive case here since's it's obviously tested elsewhere
test( "textarea in the keepNative set shouldn't be enhanced", function() {
ok( !$("textarea.should-be-native").is("ui-input-text") );
ok( !$("textarea.should-be-native").is("ui-input-text") );
});
asyncTest( "textarea should autogrow on document ready", function() {
var test = $( "#init-autogrow" );
setTimeout(function() {
ok( $( "#reference-autogrow" )[0].clientHeight < test[0].clientHeight, "the height is greater than the reference text area with no content" );
ok( test[0].clientHeight > 100, "autogrow text area's height is greater than any style padding");
start();
}, 400);
});
})(jQuery);