/[projects]/misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/dialog/dialog_deprecated.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/jquery-ui-1.10.3/tests/unit/dialog/dialog_deprecated.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 3 months ago) by torben
File MIME type: application/javascript
File size: 2591 byte(s)
initial import
1 module("dialog (deprecated): position option with string and array");
2
3 test( "position, right bottom on window w/array", function() {
4 expect( 2 );
5
6 // dialogs alter the window width and height in FF and IE7
7 // so we collect that information before creating the dialog
8 // Support: FF, IE7
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" );
16 element.remove();
17 });
18
19 test( "position, right bottom on window", function() {
20 expect( 2 );
21
22 // dialogs alter the window width and height in FF and IE7
23 // so we collect that information before creating the dialog
24 // Support: FF, IE7
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" );
32 element.remove();
33 });
34
35 test("position, offset from top left w/array", function() {
36 expect( 2 );
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);
42 element.remove();
43 });
44
45 test("position, top on window", function() {
46 expect( 2 );
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);
52 element.remove();
53 });
54
55 test("position, left on window", function() {
56 expect( 2 );
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);
62 element.remove();
63 });

  ViewVC Help
Powered by ViewVC 1.1.20