Skip to content

Commit 15c97e0

Browse files
dcneinerscottgonzalez
authored andcommitted
Dialog: Added a class to dialog wrapper when it is currently displaying buttons, includes unit tests for changes. Fixed #7057 - An extra class is needed on the dialog wrapper to specify when a buttonset is showing
1 parent 5c6afa8 commit 15c97e0

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/unit/dialog/dialog_options.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test("autoOpen", function() {
1818
});
1919

2020
test("buttons", function() {
21-
expect(17);
21+
expect(21);
2222

2323
var buttons = {
2424
"Ok": function(ev, ui) {
@@ -44,6 +44,8 @@ test("buttons", function() {
4444
});
4545

4646
ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container");
47+
ok(el.parent().hasClass('ui-dialog-buttons'), "dialog wrapper adds class about having buttons");
48+
4749
btn.trigger("click");
4850

4951
var newButtons = {
@@ -67,6 +69,12 @@ test("buttons", function() {
6769
equals(btn.eq(i).text(), key, "text of button " + (i+1));
6870
i += 1;
6971
});
72+
73+
el.dialog("option", "buttons", null);
74+
btn = $("button", dlg());
75+
equals(btn.length, 0, "all buttons have been removed");
76+
equals(el.find(".ui-dialog-buttonset").length, 0, "buttonset has been removed");
77+
equals(el.parent().hasClass('ui-dialog-buttons'), false, "dialog wrapper removes class about having buttons");
7078

7179
el.remove();
7280
});

ui/jquery.ui.dialog.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ $.widget("ui.dialog", {
353353
button.button();
354354
}
355355
});
356+
self.uiDialog.addClass( "ui-dialog-buttons" );
356357
uiDialogButtonPane.appendTo( self.uiDialog );
358+
} else {
359+
self.uiDialog.removeClass( "ui-dialog-buttons" );
357360
}
358361
},
359362

0 commit comments

Comments
 (0)