Skip to content

Commit

Permalink
Dialog: Added a class to dialog wrapper when it is currently displayi…
Browse files Browse the repository at this point in the history
…ng buttons, includes unit tests for changes. Fixed #7057 - An extra class is needed on the dialog wrapper to specify when a buttonset is showing
  • Loading branch information
dcneiner authored and gnarf committed Mar 8, 2011
1 parent ea89522 commit 6008a30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/unit/dialog/dialog_options.js
Expand Up @@ -18,7 +18,7 @@ test("autoOpen", function() {
}); });


test("buttons", function() { test("buttons", function() {
expect(17); expect(21);


var buttons = { var buttons = {
"Ok": function(ev, ui) { "Ok": function(ev, ui) {
Expand All @@ -44,6 +44,8 @@ test("buttons", function() {
}); });


ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container"); ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container");
ok(el.parent().hasClass('ui-dialog-buttons'), "dialog wrapper adds class about having buttons");

btn.trigger("click"); btn.trigger("click");


var newButtons = { var newButtons = {
Expand All @@ -67,6 +69,12 @@ test("buttons", function() {
equals(btn.eq(i).text(), key, "text of button " + (i+1)); equals(btn.eq(i).text(), key, "text of button " + (i+1));
i += 1; i += 1;
}); });

el.dialog("option", "buttons", null);
btn = $("button", dlg());
equals(btn.length, 0, "all buttons have been removed");
equals(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed");
equals(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons");


el.remove(); el.remove();
}); });
Expand Down
3 changes: 3 additions & 0 deletions ui/jquery.ui.dialog.js
Expand Up @@ -353,7 +353,10 @@ $.widget("ui.dialog", {
button.button(); button.button();
} }
}); });
self.uiDialog.addClass( "ui-dialog-buttons" );
uiDialogButtonPane.appendTo( self.uiDialog ); uiDialogButtonPane.appendTo( self.uiDialog );
} else {
self.uiDialog.removeClass( "ui-dialog-buttons" );
} }
}, },


Expand Down

0 comments on commit 6008a30

Please sign in to comment.