]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Removed broken disabled option from dialog, defuse disable/enable methods...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Sat, 17 Nov 2012 10:31:57 +0000 (11:31 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 26 Nov 2012 09:28:24 +0000 (10:28 +0100)
tests/unit/dialog/dialog_methods.js
ui/jquery.ui.dialog.js

index a4959bf8588ae995acacacc34d67f69e5304c18b..e5275c7a4fef4a6b1463a577eaa98da43a241710 100644 (file)
@@ -47,32 +47,12 @@ test("destroy", function() {
        });
 });
 
-test("enable", function() {
-       expect( 3 );
-
-       var el,
-               expected = $('<div></div>').dialog(),
-               actual = expected.dialog('enable');
-       equal(actual, expected, 'enable is chainable');
-
-       el = $('<div></div>').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 = $('<div></div>').dialog(),
-               actual = expected.dialog('disable');
-       equal(actual, expected, 'disable is chainable');
-
-       el = $('<div></div>').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 = $( "<div></div>" ).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() {
index c48d1a804e1db04682b073769fa2b58d2f9fa371..8e5ca66c1fdc3b18913854f00b564a14f73b9e76 100644 (file)
@@ -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" ) {