From 845f657ddfbf2571dc33a8c3e6c6c2a3174ee4b9 Mon Sep 17 00:00:00 2001 From: John Bender Date: Tue, 11 Oct 2011 11:32:18 -0700 Subject: [PATCH] test that autogrow is triggered on keyup --- tests/unit/textinput/index.html | 3 +++ tests/unit/textinput/textinput_core.js | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/unit/textinput/index.html b/tests/unit/textinput/index.html index 2c720209..5785181c 100644 --- a/tests/unit/textinput/index.html +++ b/tests/unit/textinput/index.html @@ -43,6 +43,9 @@ Place holder text Place holder text + + diff --git a/tests/unit/textinput/textinput_core.js b/tests/unit/textinput/textinput_core.js index dd9021e5..ffc292b1 100644 --- a/tests/unit/textinput/textinput_core.js +++ b/tests/unit/textinput/textinput_core.js @@ -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); \ No newline at end of file