diff options
-rw-r--r-- | tests/unit/dialog/dialog_options.js | 5 | ||||
-rw-r--r-- | ui/jquery.ui.dialog.js | 15 |
2 files changed, 12 insertions, 8 deletions
diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index 2df7196dc..0be8c2b7f 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -148,7 +148,7 @@ test("closeText", function() { }); test("dialogClass", function() { - expect(4); + expect( 6 ); var el = $('<div></div>').dialog(); equal(el.dialog('widget').is(".foo"), false, 'dialogClass not specified. foo class added'); @@ -156,6 +156,9 @@ test("dialogClass", function() { el = $('<div></div>').dialog({ dialogClass: "foo" }); equal(el.dialog('widget').is(".foo"), true, 'dialogClass in init. foo class added'); + el.dialog( "option", "dialogClass", "foobar" ); + equal( el.dialog('widget').is(".foo"), false, "dialogClass changed, previous one was removed" ); + equal( el.dialog('widget').is(".foobar"), true, "dialogClass changed, new one was added" ); el.remove(); el = $('<div></div>').dialog({ dialogClass: "foo bar" }); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index 055040b32..cb4230eac 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -565,6 +565,14 @@ $.widget("ui.dialog", { var isDraggable, isResizable, uiDialog = this.uiDialog; + if ( key === "dialogClass" ) { + uiDialog + .removeClass( this.options.dialogClass ) + .addClass( value ); + } + + this._super( key, value ); + switch ( key ) { case "buttons": this._createButtons( value ); @@ -575,11 +583,6 @@ $.widget("ui.dialog", { label: "" + value }); break; - case "dialogClass": - uiDialog - .removeClass( this.options.dialogClass ) - .addClass( value ); - break; case "disabled": // TODO use toggleClass( "ui-dialog-disabled", value ) if ( value ) { @@ -625,8 +628,6 @@ $.widget("ui.dialog", { .html( "" + ( value || " " ) ); break; } - - this._super( key, value ); }, _size: function() { |