OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <style> | 3 <style> |
4 body { | 4 body { |
5 height: 10000px; | 5 height: 10000px; |
6 } | 6 } |
7 | 7 |
8 dialog { | 8 dialog { |
9 padding: 0; | 9 padding: 0; |
10 margin: 0; | 10 margin: 0; |
11 height: 50px; | 11 height: 50px; |
12 width: 50px; | 12 width: 50px; |
13 } | 13 } |
14 | 14 |
15 #console { | 15 #console { |
16 position: fixed; | 16 position: fixed; |
17 } | 17 } |
18 </style> | 18 </style> |
19 <body> | 19 <body> |
20 <dialog id="top-dialog"></dialog> | 20 <dialog id="top-dialog"></dialog> |
21 <dialog id="first-middle-dialog"></dialog> | 21 <dialog id="first-middle-dialog"></dialog> |
22 <dialog id="second-middle-dialog" style="left: 100px"></dialog> | 22 <dialog id="second-middle-dialog" style="left: 100px"></dialog> |
23 <dialog id="bottom-dialog"></dialog> | 23 <dialog id="bottom-dialog"></dialog> |
24 </body> | 24 </body> |
25 <script src="../../js/resources/js-test-pre.js"></script> | 25 <script src="../../../resources/js-test.js"></script> |
26 <script> | 26 <script> |
27 debug('Test that multiple dialogs are centered properly. You should see four ' + | 27 debug('Test that multiple dialogs are centered properly. You should see four ' + |
28 'boxes: one on the top row, two on the middle, and one on the bottom.'); | 28 'boxes: one on the top row, two on the middle, and one on the bottom.'); |
29 | 29 |
30 function expectedTop(dialog) { | 30 function expectedTop(dialog) { |
31 return window.scrollY + Math.floor((document.documentElement.clientHeight -
dialog.offsetHeight) / 2); | 31 return window.scrollY + Math.floor((document.documentElement.clientHeight -
dialog.offsetHeight) / 2); |
32 } | 32 } |
33 | 33 |
34 function showAndTest(id) { | 34 function showAndTest(id) { |
35 debug('showing ' + id); | 35 debug('showing ' + id); |
36 dialog = document.getElementById(id); | 36 dialog = document.getElementById(id); |
37 dialog.show(); | 37 dialog.show(); |
38 shouldBe('dialog.offsetTop', 'expectedTop(dialog)'); | 38 shouldBe('dialog.offsetTop', 'expectedTop(dialog)'); |
39 } | 39 } |
40 | 40 |
41 showAndTest('top-dialog'); | 41 showAndTest('top-dialog'); |
42 | 42 |
43 window.scroll(0, 100); | 43 window.scroll(0, 100); |
44 showAndTest('first-middle-dialog'); | 44 showAndTest('first-middle-dialog'); |
45 showAndTest('second-middle-dialog'); | 45 showAndTest('second-middle-dialog'); |
46 | 46 |
47 window.scroll(0, 200); | 47 window.scroll(0, 200); |
48 showAndTest('bottom-dialog'); | 48 showAndTest('bottom-dialog'); |
49 </script> | 49 </script> |
50 </html> | 50 </html> |
OLD | NEW |