aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2013-02-22 09:15:43 -0500
committerScott González <scott.gonzalez@gmail.com>2013-02-22 09:15:43 -0500
commit2348fb8eb9ec1297a2588a23cf3447c5374bcb21 (patch)
tree49a5a4f341300db2e8dcba21fa6c94d3be32524c /tests
parent1c5171c2547130a76710dd20108b35774551e333 (diff)
downloadjquery-ui-2348fb8eb9ec1297a2588a23cf3447c5374bcb21.tar.gz
jquery-ui-2348fb8eb9ec1297a2588a23cf3447c5374bcb21.zip
Spinner: Call _stop() on blur. Fixes #9112 - Spinner keeps changing after losing focus.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/spinner/spinner_core.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/spinner/spinner_core.js b/tests/unit/spinner/spinner_core.js
index a1179bb35..bea5f9122 100644
--- a/tests/unit/spinner/spinner_core.js
+++ b/tests/unit/spinner/spinner_core.js
@@ -80,6 +80,33 @@ test( "keydown PAGE_DOWN on input, decreases value not less than min", function(
equal( element.val(), 20 );
});
+asyncTest( "blur input while spinning with UP", function() {
+ expect( 3 );
+ var value,
+ element = $( "#spin" ).val( 10 ).spinner();
+
+ function step1() {
+ element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } );
+ equal( element.val(), 11 );
+ setTimeout( step2, 750 );
+ }
+
+ function step2() {
+ value = element.val();
+ ok( value > 11, "repeating while key is down" );
+ element[0].blur();
+ setTimeout( step3, 250 );
+ }
+
+ function step3() {
+ equal( element.val(), value, "stopped repeating on blur" );
+ start();
+ }
+
+ element[ 0 ].focus();
+ setTimeout( step1 );
+});
+
test( "mouse click on up button, increases value not greater than max", function() {
expect( 3 );
var element = $( "#spin" ).val( 18 ).spinner({