1 module("dialog (deprecated): position option with string and array");
3 test( "position, right bottom on window w/array", function() {
6 // dialogs alter the window width and height in FF and IE7
7 // so we collect that information before creating the dialog
9 var winWidth = $( window ).width(),
10 winHeight = $( window ).height(),
11 element = $("<div></div>").dialog({ position: [ "right", "bottom" ] }),
12 dialog = element.dialog("widget"),
13 offset = dialog.offset();
14 closeEnough( offset.left, winWidth - dialog.outerWidth() + $( window ).scrollLeft(), 1, "offset left of right bottom on window w/array" );
15 closeEnough( offset.top, winHeight - dialog.outerHeight() + $( window ).scrollTop(), 1, "offset top of right bottom on window w/array" );
19 test( "position, right bottom on window", function() {
22 // dialogs alter the window width and height in FF and IE7
23 // so we collect that information before creating the dialog
25 var winWidth = $( window ).width(),
26 winHeight = $( window ).height(),
27 element = $("<div></div>").dialog({ position: "right bottom" }),
28 dialog = element.dialog("widget"),
29 offset = dialog.offset();
30 closeEnough( offset.left, winWidth - dialog.outerWidth() + $( window ).scrollLeft(), 1, "offset left of right bottom on window" );
31 closeEnough( offset.top, winHeight - dialog.outerHeight() + $( window ).scrollTop(), 1, "offset top of right bottom on window" );
35 test("position, offset from top left w/array", function() {
37 var element = $("<div></div>").dialog({ position: [10, 10] }),
38 dialog = element.dialog("widget"),
39 offset = dialog.offset();
40 closeEnough(offset.left, 10 + $(window).scrollLeft(), 1);
41 closeEnough(offset.top, 10 + $(window).scrollTop(), 1);
45 test("position, top on window", function() {
47 var element = $("<div></div>").dialog({ position: "top" }),
48 dialog = element.dialog("widget"),
49 offset = dialog.offset();
50 closeEnough(offset.left, Math.round($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft(), 1);
51 closeEnough(offset.top, $(window).scrollTop(), 1);
55 test("position, left on window", function() {
57 var element = $("<div></div>").dialog({ position: "left" }),
58 dialog = element.dialog("widget"),
59 offset = dialog.offset();
60 closeEnough(offset.left, 0, 1);
61 closeEnough(offset.top, Math.round($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop(), 1);