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 dialog is a positioned element, so the top and bottom should
not have style auto.'); | 38 debug('<br>The computed top and bottom of a centered dialog should still hav
e position auto.'); |
39 | 39 |
40 dialog.style.height = '20px'; | |
41 dialog.showModal(); | 40 dialog.showModal(); |
42 shouldBeEqualToString('window.getComputedStyle(dialog).top', '790px'); | 41 shouldBeEqualToString('window.getComputedStyle(dialog).top', 'auto'); |
43 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', '-210px'); | 42 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', 'auto'); |
44 | |
45 dialog.style.height = 'auto'; | |
46 reset(); | 43 reset(); |
47 }()); | 44 }()); |
48 | 45 |
49 (function() { | 46 (function() { |
50 debug('<br>Dialog should be recentered if showModal() is called after close(
).'), | 47 debug('<br>Dialog should be recentered if showModal() is called after close(
).'), |
51 | 48 |
52 dialog.showModal(); | 49 dialog.showModal(); |
53 dialog.close(); | 50 dialog.close(); |
54 window.scroll(0, 2 * window.scrollY); | 51 window.scroll(0, 2 * window.scrollY); |
55 dialog.showModal(); | 52 dialog.showModal(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 (function() { | 180 (function() { |
184 debug('<br>A dialog with specified \'bottom\' should be positioned as usual'
); | 181 debug('<br>A dialog with specified \'bottom\' should be positioned as usual'
); |
185 offset = 50; | 182 offset = 50; |
186 dialog.style.bottom = offset + 'px'; | 183 dialog.style.bottom = offset + 'px'; |
187 dialog.showModal(); | 184 dialog.showModal(); |
188 shouldBe('dialog.getBoundingClientRect().bottom + window.scrollY', 'window.i
nnerHeight - offset'); | 185 shouldBe('dialog.getBoundingClientRect().bottom + window.scrollY', 'window.i
nnerHeight - offset'); |
189 dialog.style.bottom = 'auto'; | 186 dialog.style.bottom = 'auto'; |
190 reset(); | 187 reset(); |
191 }()); | 188 }()); |
192 </script> | 189 </script> |
OLD | NEW |