test that autogrow is triggered on keyup

This commit is contained in:
John Bender 2011-10-11 11:32:18 -07:00
parent 5150114c13
commit 845f657ddf
2 changed files with 18 additions and 0 deletions

View file

@ -43,6 +43,9 @@
Place holder text
Place holder text
</textarea>
<textarea id="keyup-autogrow">
</textarea>
</div>
</body>
</html>

View file

@ -24,4 +24,19 @@
start();
}, 400);
});
asyncTest( "textarea should autogrow when text is added via the keyboard", function() {
var test = $( "#keyup-autogrow" ),
originalHeight = test[0].clientHeight;
test.keyup(function() {
setTimeout(function() {
ok( test[0].clientHeight > originalHeight, "the height is greater than original with no content" );
ok( test[0].clientHeight > 100, "autogrow text area's height is greater any style/padding");
start();
}, 400)
});
test.val("foo\n\n\n\n\n\n\n\n\n\n\n\n\n\n").trigger("keyup");
});
})(jQuery);