OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <link href="resources/dialog-layout.css" rel="stylesheet"> | 2 <link href="resources/dialog-layout.css" rel="stylesheet"> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 <dialog id="dialog">It is my dialog.</dialog> | 4 <dialog id="dialog">It is my dialog.</dialog> |
5 <div id="absolute-div"> | 5 <div id="absolute-div"> |
6 <div id="relative-div"></div> | 6 <div id="relative-div"></div> |
7 </div> | 7 </div> |
8 <script> | 8 <script> |
9 description('Tests layout of absolutely positioned modal dialogs.'); | 9 description('Tests layout of absolutely positioned modal dialogs.'); |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 (function() { | 29 (function() { |
30 debug('<br>showModal() should center in the viewport.'); | 30 debug('<br>showModal() should center in the viewport.'); |
31 | 31 |
32 dialog.showModal(); | 32 dialog.showModal(); |
33 checkCentered(dialog); | 33 checkCentered(dialog); |
34 reset(); | 34 reset(); |
35 }()); | 35 }()); |
36 | 36 |
37 (function() { | 37 (function() { |
38 debug('<br>The computed top and bottom of a centered dialog should still hav
e position auto.'); | 38 debug('<br>The dialog is a positioned element, so the top and bottom should
not have style auto.'); |
39 | 39 |
| 40 dialog.style.height = '20px'; |
40 dialog.showModal(); | 41 dialog.showModal(); |
41 shouldBeEqualToString('window.getComputedStyle(dialog).top', 'auto'); | 42 shouldBeEqualToString('window.getComputedStyle(dialog).top', '790px'); |
42 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', 'auto'); | 43 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', '-210px'); |
| 44 |
| 45 dialog.style.height = 'auto'; |
43 reset(); | 46 reset(); |
44 }()); | 47 }()); |
45 | 48 |
46 (function() { | 49 (function() { |
47 debug('<br>Dialog should be recentered if showModal() is called after close(
).'), | 50 debug('<br>Dialog should be recentered if showModal() is called after close(
).'), |
48 | 51 |
49 dialog.showModal(); | 52 dialog.showModal(); |
50 dialog.close(); | 53 dialog.close(); |
51 window.scroll(0, 2 * window.scrollY); | 54 window.scroll(0, 2 * window.scrollY); |
52 dialog.showModal(); | 55 dialog.showModal(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 (function() { | 183 (function() { |
181 debug('<br>A dialog with specified \'bottom\' should be positioned as usual'
); | 184 debug('<br>A dialog with specified \'bottom\' should be positioned as usual'
); |
182 offset = 50; | 185 offset = 50; |
183 dialog.style.bottom = offset + 'px'; | 186 dialog.style.bottom = offset + 'px'; |
184 dialog.showModal(); | 187 dialog.showModal(); |
185 shouldBe('dialog.getBoundingClientRect().bottom + window.scrollY', 'window.i
nnerHeight - offset'); | 188 shouldBe('dialog.getBoundingClientRect().bottom + window.scrollY', 'window.i
nnerHeight - offset'); |
186 dialog.style.bottom = 'auto'; | 189 dialog.style.bottom = 'auto'; |
187 reset(); | 190 reset(); |
188 }()); | 191 }()); |
189 </script> | 192 </script> |
OLD | NEW |