From 93abe02b6052143fac30393291da3fc254bde996 Mon Sep 17 00:00:00 2001 From: TJ VanToll Date: Mon, 19 Nov 2012 15:42:28 -0500 Subject: [PATCH] Button: Fixing handling of the disabled options on refresh method calls. Fixed #8828 - Button: Refresh does not re-enable disabled button. --- tests/unit/button/button_methods.js | 36 +++++++++++++++++++++++++++++ tests/unit/button/button_tickets.js | 8 ------- ui/jquery.ui.button.js | 4 +++- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/tests/unit/button/button_methods.js b/tests/unit/button/button_methods.js index 6a305d654..c53444005 100644 --- a/tests/unit/button/button_methods.js +++ b/tests/unit/button/button_methods.js @@ -13,4 +13,40 @@ test("destroy", function() { }); }); +test( "refresh: Ensure disabled state is preserved correctly.", function() { + expect( 8 ); + + var element = $( "" ); + element.button({ disabled: true }).button( "refresh" ); + ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237 + + element = $( "
" ); + element.button({ disabled: true }).button( "refresh" ); + ok( element.button( "option", "disabled" ), "
buttons should remain disabled after refresh" ); + + element = $( "" ); + element.button( { disabled: true} ).button( "refresh" ); + ok( element.button( "option", "disabled" ), "" ); + element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" ); + ok( !element.button( "option", "disabled" ), "Changing a