diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-05-10 17:59:55 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-10 17:59:55 -0400 |
commit | d393c8b4cb26ec34878c22202da6ba9393e0094d (patch) | |
tree | d1aa311ebe221eef1af3ebeebd3c61dd646ba113 /tests | |
parent | ab4d8b748d26df79f7e9cf32a5f80d07c05f790b (diff) | |
download | jquery-ui-d393c8b4cb26ec34878c22202da6ba9393e0094d.tar.gz jquery-ui-d393c8b4cb26ec34878c22202da6ba9393e0094d.zip |
Spinner: Handle async focus events in IE. Fixes incorrect detection of changes.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/spinner/spinner_events.js | 96 |
1 files changed, 51 insertions, 45 deletions
diff --git a/tests/unit/spinner/spinner_events.js b/tests/unit/spinner/spinner_events.js index 133a8d5a2..72b185528 100644 --- a/tests/unit/spinner/spinner_events.js +++ b/tests/unit/spinner/spinner_events.js @@ -121,7 +121,7 @@ test( "stop", function() { element.spinner( "value", 999 ); }); -test( "change", function() { +asyncTest( "change", function() { expect( 14 ); var element = $( "#spin" ).spinner(); @@ -174,50 +174,56 @@ test( "change", function() { shouldChange( false, "button up, before blur" ); element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); shouldChange( true, "blur after button up" ); - element.blur(); - - shouldChange( false, "button down, before blur" ); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); - shouldChange( true, "blur after button down" ); - element.blur(); - - shouldChange( false, "many buttons, same final value, before blur" ); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); - shouldChange( false, "blur after many buttons, same final value" ); - element.blur(); - - shouldChange( true, "stepUp" ); - element.spinner( "stepUp" ); - - shouldChange( true, "stepDown" ); - element.spinner( "stepDown" ); - - shouldChange( true, "pageUp" ); - element.spinner( "pageUp" ); - - shouldChange( true, "pageDown" ); - element.spinner( "pageDown" ); - - shouldChange( true, "value" ); - element.spinner( "value", 999 ); - - shouldChange( false, "value, same value" ); - element.spinner( "value", 999 ); - - shouldChange( true, "max, value changed" ); - element.spinner( "option", "max", 900 ); - - shouldChange( false, "max, value not changed" ); - element.spinner( "option", "max", 1000 ); - - shouldChange( true, "min, value changed" ); - element.spinner( "option", "min", 950 ); - - shouldChange( false, "min, value not changed" ); - element.spinner( "option", "min", 200 ); + setTimeout(function() { + element.blur(); + + shouldChange( false, "button down, before blur" ); + element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + shouldChange( true, "blur after button down" ); + setTimeout(function() { + element.blur(); + + shouldChange( false, "many buttons, same final value, before blur" ); + element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + shouldChange( false, "blur after many buttons, same final value" ); + element.blur(); + setTimeout(function() { + shouldChange( true, "stepUp" ); + element.spinner( "stepUp" ); + + shouldChange( true, "stepDown" ); + element.spinner( "stepDown" ); + + shouldChange( true, "pageUp" ); + element.spinner( "pageUp" ); + + shouldChange( true, "pageDown" ); + element.spinner( "pageDown" ); + + shouldChange( true, "value" ); + element.spinner( "value", 999 ); + + shouldChange( false, "value, same value" ); + element.spinner( "value", 999 ); + + shouldChange( true, "max, value changed" ); + element.spinner( "option", "max", 900 ); + + shouldChange( false, "max, value not changed" ); + element.spinner( "option", "max", 1000 ); + + shouldChange( true, "min, value changed" ); + element.spinner( "option", "min", 950 ); + + shouldChange( false, "min, value not changed" ); + element.spinner( "option", "min", 200 ); + start(); + }); + }); + }); }); })( jQuery ); |