mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Spinner: Call _stop() on blur. Fixes #9112 - Spinner keeps changing after losing focus.
This commit is contained in:
parent
1c5171c254
commit
2348fb8eb9
@ -80,6 +80,33 @@ test( "keydown PAGE_DOWN on input, decreases value not less than min", function(
|
|||||||
equal( element.val(), 20 );
|
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() {
|
test( "mouse click on up button, increases value not greater than max", function() {
|
||||||
expect( 3 );
|
expect( 3 );
|
||||||
var element = $( "#spin" ).val( 18 ).spinner({
|
var element = $( "#spin" ).val( 18 ).spinner({
|
||||||
|
1
ui/jquery.ui.spinner.js
vendored
1
ui/jquery.ui.spinner.js
vendored
@ -102,6 +102,7 @@ $.widget( "ui.spinner", {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._stop();
|
||||||
this._refresh();
|
this._refresh();
|
||||||
if ( this.previous !== this.element.val() ) {
|
if ( this.previous !== this.element.val() ) {
|
||||||
this._trigger( "change", event );
|
this._trigger( "change", event );
|
||||||
|
Loading…
Reference in New Issue
Block a user