mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
dialog: fixed _position regression; wrote a test for the default positon, which still needs some tuning
This commit is contained in:
parent
c59c0421ba
commit
122a6cdd5f
@ -240,7 +240,16 @@ test("modal", function() {
|
||||
ok(false, 'missing test - untested code is broken code');
|
||||
});
|
||||
|
||||
test("position", function() {
|
||||
test("position, default center on window", function() {
|
||||
var el = $('<div></div>').dialog();
|
||||
var offset = el.parent().offset();
|
||||
// use .position() instead to avoid replicating center-logic?
|
||||
same(offset.left, Math.floor($(window).width() / 2 - el.parent().width() / 2));
|
||||
same(offset.top, Math.floor($(window).height() / 2 - el.parent().height() / 2));
|
||||
el.remove();
|
||||
});
|
||||
|
||||
test("position, others", function() {
|
||||
ok(false, 'missing test - untested code is broken code');
|
||||
});
|
||||
|
||||
|
5
ui/jquery.ui.dialog.js
vendored
5
ui/jquery.ui.dialog.js
vendored
@ -382,8 +382,8 @@ $.widget("ui.dialog", {
|
||||
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
|
||||
// if (typeof position == 'string' || $.isArray(position)) {
|
||||
// myAt = $.isArray(position) ? position : position.split(' ');
|
||||
if (!position || (typeof positon != "string" && typeof positon != "object"))
|
||||
return
|
||||
|
||||
if (position && (typeof positon == "string" || typeof positon == "object")) {
|
||||
if (typeof position == 'string' || '0' in position) {
|
||||
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
||||
if (myAt.length == 1) {
|
||||
@ -413,6 +413,7 @@ $.widget("ui.dialog", {
|
||||
offset[1] = -position.bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.uiDialog.position({
|
||||
my: myAt.join(' '),
|
||||
|
Loading…
Reference in New Issue
Block a user