You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
closeEnough(offset.left,Math.round(winWidth/2-dialog.outerWidth()/2)+$(window).scrollLeft(),1,"dialog left position of center on window on initilization");
353
+
closeEnough(offset.top,Math.round(winHeight/2-dialog.outerHeight()/2)+$(window).scrollTop(),1,"dialog top position of center on window on initilization");
348
354
el.remove();
349
355
});
350
356
351
-
// todo: figure out these fails in IE7
352
-
if(!$.ui.ie){
353
-
test("position, right bottom at right bottom via ui.position args",function(){
354
-
expect(2);
355
-
varel=$('<div></div>').dialog({
356
-
position: {
357
-
my: "right bottom",
358
-
at: "right bottom"
359
-
}
360
-
}),
361
-
dialog=el.dialog('widget'),
362
-
offset=dialog.offset();
357
+
test("position, right bottom at right bottom via ui.position args",function(){
// dialogs alter the window width and height in FF and IE7
361
+
// so we collect that information before creating the dialog
362
+
// Support: FF, IE7
363
+
varwinWidth=$(window).width(),
364
+
winHeight=$(window).height(),
365
+
el=$("<div></div>").dialog({
366
+
position: {
367
+
my: "right bottom",
368
+
at: "right bottom"
369
+
}
370
+
}),
371
+
dialog=el.dialog("widget"),
372
+
offset=dialog.offset();
373
+
374
+
closeEnough(offset.left,winWidth-dialog.outerWidth()+$(window).scrollLeft(),1,"dialog left position of right bottom at right bottom on initilization");
375
+
closeEnough(offset.top,winHeight-dialog.outerHeight()+$(window).scrollTop(),1,"dialog top position of right bottom at right bottom on initilization");
376
+
el.remove();
377
+
});
369
378
370
-
test("position, at another element",function(){
379
+
test("position, at another element",function(){
371
380
expect(4);
372
381
varparent=$('<div></div>').css({
373
382
position: 'absolute',
374
383
top: 400,
375
384
left: 600,
376
385
height: 10,
377
386
width: 10
378
-
}).appendTo('body'),
387
+
}).appendTo("body"),
379
388
380
-
el=$('<div></div>').dialog({
389
+
el=$("<div></div>").dialog({
381
390
position: {
382
391
my: "left top",
383
392
at: "left top",
384
-
of: parent
393
+
of: parent,
394
+
collision: "none"
385
395
}
386
396
}),
387
397
388
-
dialog=el.dialog('widget'),
398
+
dialog=el.dialog("widget"),
389
399
offset=dialog.offset();
390
400
391
-
deepEqual(offset.left,600);
392
-
deepEqual(offset.top,400);
401
+
closeEnough(offset.left,600,1,"dialog left position at another element on initilization");
402
+
closeEnough(offset.top,400,1,"dialog top position at another element on initilization");
393
403
394
-
el.dialog('option','position',{
404
+
el.dialog("option","position",{
395
405
my: "left top",
396
406
at: "right bottom",
397
-
of: parent
407
+
of: parent,
408
+
collision: "none"
398
409
});
399
410
400
411
offset=dialog.offset();
401
412
402
-
deepEqual(offset.left,610);
403
-
deepEqual(offset.top,410);
413
+
closeEnough(offset.left,610,1,"dialog left position at another element via setting option");
414
+
closeEnough(offset.top,410,1,"dialog top position at another element via setting option");
0 commit comments