]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Added a class to dialog wrapper when it is currently displaying buttons,...
authorDouglas Neiner <doug@pixelgraphics.us>
Wed, 2 Mar 2011 17:52:21 +0000 (12:52 -0500)
committergnarf <gnarf@gnarf.net>
Tue, 8 Mar 2011 06:52:07 +0000 (00:52 -0600)
tests/unit/dialog/dialog_options.js
ui/jquery.ui.dialog.js

index 82f28bf859e7b9547b0ae26b3190631d4260bf8b..fb8dea77542eddf873d94609d3d86a79aa9114e3 100644 (file)
@@ -18,7 +18,7 @@ test("autoOpen", function() {
 });
 
 test("buttons", function() {
-       expect(17);
+       expect(21);
 
        var buttons = {
                "Ok": function(ev, ui) {
@@ -44,6 +44,8 @@ test("buttons", function() {
        });
 
        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");
 
        var newButtons = {
@@ -67,6 +69,12 @@ test("buttons", function() {
                equals(btn.eq(i).text(), key, "text of button " + (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();
 });
index 0183dd80199cb824c2294c12a1265e3a1c16f493..49378389646e1e2020880c35739a5f9630de6fd0 100644 (file)
@@ -353,7 +353,10 @@ $.widget("ui.dialog", {
                                        button.button();
                                }
                        });
+                       self.uiDialog.addClass( "ui-dialog-buttons" );
                        uiDialogButtonPane.appendTo( self.uiDialog );
+               } else {
+                       self.uiDialog.removeClass( "ui-dialog-buttons" );
                }
        },