diff options
-rw-r--r-- | demos/spinner/currency.html | 2 | ||||
-rw-r--r-- | demos/spinner/decimal.html | 2 | ||||
-rw-r--r-- | demos/spinner/default.html | 8 | ||||
-rw-r--r-- | demos/spinner/time.html | 2 | ||||
-rw-r--r-- | tests/unit/spinner/core.js | 8 | ||||
-rw-r--r-- | tests/unit/spinner/events.js | 24 | ||||
-rw-r--r-- | tests/unit/spinner/options.js | 4 | ||||
-rw-r--r-- | ui/spinner.js | 2 |
8 files changed, 26 insertions, 26 deletions
diff --git a/demos/spinner/currency.html b/demos/spinner/currency.html index b39a431c5..0509e80a0 100644 --- a/demos/spinner/currency.html +++ b/demos/spinner/currency.html @@ -16,7 +16,7 @@ <link rel="stylesheet" href="../demos.css"> <script> $(function() { - $( "#currency" ).change(function() { + $( "#currency" ).on( "change", function() { $( "#spinner" ).spinner( "option", "culture", $( this ).val() ); }); diff --git a/demos/spinner/decimal.html b/demos/spinner/decimal.html index d321f0312..6c3df9439 100644 --- a/demos/spinner/decimal.html +++ b/demos/spinner/decimal.html @@ -21,7 +21,7 @@ numberFormat: "n" }); - $( "#culture" ).change(function() { + $( "#culture" ).on( "change", function() { var current = $( "#spinner" ).spinner( "value" ); Globalize.culture( $(this).val() ); $( "#spinner" ).spinner( "value", current ); diff --git a/demos/spinner/default.html b/demos/spinner/default.html index 9486422fc..328d4d13c 100644 --- a/demos/spinner/default.html +++ b/demos/spinner/default.html @@ -15,24 +15,24 @@ $(function() { var spinner = $( "#spinner" ).spinner(); - $( "#disable" ).click(function() { + $( "#disable" ).on( "click", function() { if ( spinner.spinner( "option", "disabled" ) ) { spinner.spinner( "enable" ); } else { spinner.spinner( "disable" ); } }); - $( "#destroy" ).click(function() { + $( "#destroy" ).on( "click", function() { if ( spinner.spinner( "instance" ) ) { spinner.spinner( "destroy" ); } else { spinner.spinner(); } }); - $( "#getvalue" ).click(function() { + $( "#getvalue" ).on( "click", function() { alert( spinner.spinner( "value" ) ); }); - $( "#setvalue" ).click(function() { + $( "#setvalue" ).on( "click", function() { spinner.spinner( "value", 5 ); }); diff --git a/demos/spinner/time.html b/demos/spinner/time.html index 2a527e42b..229b0e6b4 100644 --- a/demos/spinner/time.html +++ b/demos/spinner/time.html @@ -41,7 +41,7 @@ $(function() { $( "#spinner" ).timespinner(); - $( "#culture" ).change(function() { + $( "#culture" ).on( "change", function() { var current = $( "#spinner" ).timespinner( "value" ); Globalize.culture( $(this).val() ); $( "#spinner" ).timespinner( "value", current ); diff --git a/tests/unit/spinner/core.js b/tests/unit/spinner/core.js index aabfd7aa5..2dc118666 100644 --- a/tests/unit/spinner/core.js +++ b/tests/unit/spinner/core.js @@ -114,7 +114,7 @@ asyncTest( "blur input while spinning with UP", function() { value = element.val(); ok( value > 11, "repeating while key is down" ); - element.bind( "blur", function() { + element.on( "blur", function() { value = element.val(); setTimeout( step3, 750 ); })[ 0 ].blur(); @@ -225,16 +225,16 @@ test( "ARIA attributes", function() { test( "focus text field when pressing button", function() { expect( 2 ); var element = $( "#spin" ).spinner(); - $( "body" ).focus(); + $( "body" ).trigger( "focus" ); ok( element[ 0 ] !== document.activeElement, "not focused before" ); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ); ok( element[ 0 ] === document.activeElement, "focused after" ); }); test( "don't clear invalid value on blur", function() { expect( 1 ); var element = $( "#spin" ).spinner(); - element.focus().val( "a" ).blur(); + element.trigger( "focus" ).val( "a" ).trigger( "blur" ); equal( element.val(), "a" ); }); diff --git a/tests/unit/spinner/events.js b/tests/unit/spinner/events.js index a837f47c9..14445f48e 100644 --- a/tests/unit/spinner/events.js +++ b/tests/unit/spinner/events.js @@ -29,9 +29,9 @@ test( "start", function() { simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN ); shouldStart( true, "button up" ); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldStart( true, "button down" ); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldStart( true, "stepUp" ); element.spinner( "stepUp" ); @@ -68,9 +68,9 @@ test( "spin", function() { simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN ); shouldSpin( true, "button up" ); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldSpin( true, "button down" ); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldSpin( true, "stepUp" ); element.spinner( "stepUp" ); @@ -107,9 +107,9 @@ test( "stop", function() { simulateKeyDownUp( element, $.ui.keyCode.PAGE_DOWN ); shouldStop( true, "button up" ); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldStop( true, "button down" ); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldStop( true, "stepUp" ); element.spinner( "stepUp" ); @@ -200,7 +200,7 @@ asyncTest( "change", function() { shouldChange( false, "blur after many keys, same final value" ); shouldChange( false, "button up, before blur" ); - element.spinner( "widget" ).find( ".ui-spinner-up" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldChange( true, "blur after button up" ); }, step7 ); } @@ -208,7 +208,7 @@ asyncTest( "change", function() { function step7() { focusWrap(function() { shouldChange( false, "button down, before blur" ); - element.spinner( "widget" ).find( ".ui-spinner-down" ).mousedown().mouseup(); + element.spinner( "widget" ).find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldChange( true, "blur after button down" ); }, step8 ); } @@ -216,10 +216,10 @@ asyncTest( "change", function() { function step8() { focusWrap(function() { 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(); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); + element.spinner( "widget" ).find( ".ui-spinner-up" ).trigger( "mousedown" ).trigger( "mouseup" ); + element.spinner( "widget" ).find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); + element.spinner( "widget" ).find( ".ui-spinner-down" ).trigger( "mousedown" ).trigger( "mouseup" ); shouldChange( false, "blur after many buttons, same final value" ); }, step9 ); } diff --git a/tests/unit/spinner/options.js b/tests/unit/spinner/options.js index f8d9ad396..fa57e6096 100644 --- a/tests/unit/spinner/options.js +++ b/tests/unit/spinner/options.js @@ -181,7 +181,7 @@ test( "max", function() { element.spinner( "value", 1000 ); equal( element.val(), 100, "max constrained in value method" ); - element.val( 1000 ).blur(); + element.val( 1000 ).trigger( "blur" ); equal( element.val(), 1000, "max not constrained if manual entry" ); }); @@ -209,7 +209,7 @@ test( "min", function() { element.spinner( "value", -1000 ); equal( element.val(), -100, "min constrained in value method" ); - element.val( -1000 ).blur(); + element.val( -1000 ).trigger( "blur" ); equal( element.val(), -1000, "min not constrained if manual entry" ); }); diff --git a/ui/spinner.js b/ui/spinner.js index 9a08208c1..236a66afa 100644 --- a/ui/spinner.js +++ b/ui/spinner.js @@ -165,7 +165,7 @@ return $.widget( "ui.spinner", { function checkFocus() { var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ); if ( !isActive ) { - this.element.focus(); + this.element.trigger( "focus" ); this.previous = previous; // support: IE // IE sets focus asynchronously, so we need to check if focus |