mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Dialog: modified so that minWidth is respected. Fixes #5531 - dialog width should be at least minWidth on creation.
This commit is contained in:
parent
90caa93a9b
commit
c5770c0e84
@ -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 = $('<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);
|
||||
|
4
ui/jquery.ui.dialog.js
vendored
4
ui/jquery.ui.dialog.js
vendored
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user