4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../../forms/resources/common.js"></script>
6 <script src=
"../../forms/resources/picker-common.js"></script>
7 <script src=
"../calendar-picker/resources/calendar-picker-common.js"></script>
10 <p id=
"description"></p>
11 <div id=
"console"></div>
13 <input type=
"date" id=
"date">
16 description('Test for child elements of a datalist element.');
18 openPicker(document
.getElementById('date'), test
);
20 function makeRect(x
, y
, width
, height
) {
30 Object
.defineProperty(popupWindow
, 'screen', {
41 debug("Move anchor element along the vertical axis.");
43 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, -20, 20, 10);
44 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,-10,30,10)');
46 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, -10, 20, 10);
47 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,0,30,10)');
49 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 0, 20, 10);
50 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,10,30,10)');
52 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 10, 20, 10);
53 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,20,30,10)');
55 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 20, 20, 10);
56 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,30,30,10)');
58 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 30, 20, 10);
59 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,40,30,10)');
61 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 40, 20, 10);
62 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,50,30,10)');
64 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 50, 20, 10);
65 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,40,30,10)');
67 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 60, 20, 10);
68 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,50,30,10)');
70 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 70, 20, 10);
71 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,60,30,10)');
73 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 80, 20, 10);
74 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,70,30,10)');
76 debug("Move anchor element along the horizontal axis.");
78 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(-40, 0, 20, 10);
79 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-40,10,30,10)');
81 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(-30, 0, 20, 10);
82 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-30,10,30,10)');
84 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(-20, 0, 20, 10);
85 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-20,10,30,10)');
87 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(-10, 0, 20, 10);
88 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(-10,10,30,10)');
90 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 0, 20, 10);
91 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(0,10,30,10)');
93 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(10, 0, 20, 10);
94 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(10,10,30,10)');
96 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(20, 0, 20, 10);
97 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(20,10,30,10)');
99 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 20, 10);
100 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(30,10,30,10)');
102 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(40, 0, 20, 10);
103 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(40,10,30,10)');
105 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(50, 0, 20, 10);
106 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(50,10,30,10)');
108 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(60, 0, 20, 10);
109 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(50,10,30,10)');
111 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(70, 0, 20, 10);
112 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(60,10,30,10)');
114 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(80, 0, 20, 10);
115 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(70,10,30,10)');
117 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(90, 0, 20, 10);
118 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(80,10,30,10)');
120 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(100, 0, 20, 10);
121 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(90,10,30,10)');
123 debug("Move anchor element along the vertical axis. Open popup that is too tall.");
125 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, -20, 20, 10);
126 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,-10,30,60)');
128 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, -10, 20, 10);
129 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,60)');
131 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 0, 20, 10);
132 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,10,30,50)');
134 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 10, 20, 10);
135 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,20,30,40)');
137 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 20, 20, 10);
138 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,30,30,30)');
140 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 30, 20, 10);
141 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,30)');
143 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 40, 20, 10);
144 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,40)');
146 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 50, 20, 10);
147 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,50)');
149 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 60, 20, 10);
150 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,0,30,60)');
152 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 70, 20, 10);
153 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,10,30,60)');
155 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 80, 20, 10);
156 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 10).toString()', 'Rectangle(0,20,30,60)');
158 debug("Move anchor element along the vertical axis. Open popup that is too tall and won't shrink.");
160 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, -20, 20, 10);
161 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-10,30,1000)');
163 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, -10, 20, 10);
164 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,0,30,1000)');
166 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 0, 20, 10);
167 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,10,30,1000)');
169 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 10, 20, 10);
170 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,20,30,1000)');
172 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 20, 20, 10);
173 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,30,30,1000)');
175 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 30, 20, 10);
176 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-970,30,1000)');
178 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 40, 20, 10);
179 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-960,30,1000)');
181 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 50, 20, 10);
182 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-950,30,1000)');
184 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 60, 20, 10);
185 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-940,30,1000)');
187 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 70, 20, 10);
188 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-930,30,1000)');
190 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(0, 80, 20, 10);
191 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 1000, 30, 1000).toString()', 'Rectangle(0,-920,30,1000)');
193 debug("Grow popup width.");
195 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
196 shouldBeEqualToString('popupWindow.adjustWindowRect(30, 10, 30, 10).toString()', 'Rectangle(30,10,30,10)');
198 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
199 shouldBeEqualToString('popupWindow.adjustWindowRect(40, 10, 40, 10).toString()', 'Rectangle(30,10,40,10)');
201 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
202 shouldBeEqualToString('popupWindow.adjustWindowRect(50, 10, 50, 10).toString()', 'Rectangle(30,10,50,10)');
204 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
205 shouldBeEqualToString('popupWindow.adjustWindowRect(60, 10, 60, 10).toString()', 'Rectangle(0,10,60,10)');
207 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
208 shouldBeEqualToString('popupWindow.adjustWindowRect(70, 10, 70, 10).toString()', 'Rectangle(30,10,70,10)');
210 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
211 shouldBeEqualToString('popupWindow.adjustWindowRect(80, 10, 80, 10).toString()', 'Rectangle(30,10,80,10)');
213 popupWindow
.global
.params
.anchorRectInScreen
= makeRect(30, 0, 30, 10);
214 shouldBeEqualToString('popupWindow.adjustWindowRect(90, 10, 90, 10).toString()', 'Rectangle(30,10,90,10)');