From: Jörn Zaefferer Date: Sat, 17 Nov 2012 10:31:57 +0000 (+0100) Subject: Dialog: Removed broken disabled option from dialog, defuse disable/enable methods... X-Git-Tag: 1.10.0-beta.1~100 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0be97bf8c01394cd68134b104bcbf30b27859531;p=jquery-ui.git Dialog: Removed broken disabled option from dialog, defuse disable/enable methods. Disabling dialogs is not supported. --- diff --git a/tests/unit/dialog/dialog_methods.js b/tests/unit/dialog/dialog_methods.js index a4959bf85..e5275c7a4 100644 --- a/tests/unit/dialog/dialog_methods.js +++ b/tests/unit/dialog/dialog_methods.js @@ -47,32 +47,12 @@ test("destroy", function() { }); }); -test("enable", function() { - expect( 3 ); - - var el, - expected = $('
').dialog(), - actual = expected.dialog('enable'); - equal(actual, expected, 'enable is chainable'); - - el = $('
').dialog({ disabled: true }); - el.dialog('enable'); - equal(el.dialog('option', 'disabled'), false, 'enable method sets disabled option to false'); - ok(!el.dialog('widget').hasClass('ui-dialog-disabled'), 'enable method removes ui-dialog-disabled class from ui-dialog element'); -}); - -test("disable", function() { - expect( 3 ); - - var el, - expected = $('
').dialog(), - actual = expected.dialog('disable'); - equal(actual, expected, 'disable is chainable'); - - el = $('
').dialog({ disabled: false }); - el.dialog('disable'); - equal(el.dialog('option', 'disabled'), true, 'disable method sets disabled option to true'); - ok(el.dialog('widget').hasClass('ui-dialog-disabled'), 'disable method adds ui-dialog-disabled class to ui-dialog element'); +test( "enable/disable disabled", function() { + expect( 2 ); + var el = $( "
" ).dialog(); + el.dialog( "disable" ); + equal(el.dialog( "option", "disabled" ), false, "disable method doesn't do anything" ); + ok( !el.dialog( "widget" ).hasClass( "ui-dialog-disabled" ), "disable method doesn't add ui-dialog-disabled class" ); }); test("close", function() { diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index c48d1a804..8e5ca66c1 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -152,6 +152,9 @@ $.widget("ui.dialog", { return this.uiDialog; }, + disable: $.noop, + enable: $.noop, + close: function( event ) { var that = this; @@ -578,6 +581,10 @@ $.widget("ui.dialog", { .addClass( value ); } + if ( key === "disabled" ) { + return; + } + this._super( key, value ); if ( key === "buttons" ) {