Skip to content

Commit

Permalink
Dialog: modified so that minWidth is respected. Fixes #5531 - dialog …
Browse files Browse the repository at this point in the history
…width should be at least minWidth on creation.
  • Loading branch information
Ziling Zhao authored and scottgonzalez committed Jul 30, 2010
1 parent 90caa93 commit c5770c0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/unit/dialog/dialog_tickets.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,4 +40,25 @@ test("#5184: isOpen in dialogclose event is true", function() {
el.remove(); el.remove();
}); });


test("#5531: dialog width should be at least minWidth on creation", function () {
el = $('<div></div>').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 = $('<div></div>').dialog({
minWidth: 300
});
ok(el.dialog('option', 'width') >= 300, "width is at least 300");
el.remove();

});

})(jQuery); })(jQuery);
4 changes: 4 additions & 0 deletions ui/jquery.ui.dialog.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -628,6 +628,10 @@ $.widget("ui.dialog", {
height: 0 height: 0
}); });


if (options.minWidth > options.width) {
options.width = options.minWidth;
}

// reset wrapper sizing // reset wrapper sizing
// determine the height of all the non-content elements // determine the height of all the non-content elements
nonContentHeight = this.uiDialog.css({ nonContentHeight = this.uiDialog.css({
Expand Down

0 comments on commit c5770c0

Please sign in to comment.