From: Ziling Zhao Date: Mon, 19 Apr 2010 22:42:34 +0000 (-0700) Subject: Dialog: modified so that minWidth is respected. Fixes #5531 - dialog width should... X-Git-Tag: 1.8.3~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c5770c0e84b786ebe55a60034da0ff06dc02f422;p=jquery-ui.git Dialog: modified so that minWidth is respected. Fixes #5531 - dialog width should be at least minWidth on creation. --- diff --git a/tests/unit/dialog/dialog_tickets.js b/tests/unit/dialog/dialog_tickets.js index 296102c9b..dfa480fb7 100644 --- a/tests/unit/dialog/dialog_tickets.js +++ b/tests/unit/dialog/dialog_tickets.js @@ -40,4 +40,25 @@ test("#5184: isOpen in dialogclose event is true", function() { el.remove(); }); +test("#5531: dialog width should be at least minWidth on creation", function () { + el = $('
').dialog({ + width: 200, + minWidth: 300 + }); + + equals(el.dialog('option', 'width'), 300, "width is minWidth"); + el.dialog('option', 'width', 200); + equals(el.dialog('option', 'width'), 300, "width unchanged when set to < minWidth"); + el.dialog('option', 'width', 320); + equals(el.dialog('option', 'width'), 320, "width changed if set to > minWidth"); + el.remove(); + + el = $('
').dialog({ + minWidth: 300 + }); + ok(el.dialog('option', 'width') >= 300, "width is at least 300"); + el.remove(); + +}); + })(jQuery); diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index df11e2190..44f5cbbbc 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -628,6 +628,10 @@ $.widget("ui.dialog", { height: 0 }); + if (options.minWidth > options.width) { + options.width = options.minWidth; + } + // reset wrapper sizing // determine the height of all the non-content elements nonContentHeight = this.uiDialog.css({