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 <style> | 3 <style> |
4 dialog { | 4 dialog { |
5 position: fixed; | 5 position: fixed; |
6 } | 6 } |
7 </style> | 7 </style> |
8 <script src="../../../resources/js-test.js"></script> | 8 <script src="../../../resources/js-test.js"></script> |
9 <dialog id="dialog">It is my dialog.</dialog> | 9 <dialog id="dialog">It is my dialog.</dialog> |
10 <div id="absolute-div"> | 10 <div id="absolute-div"> |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 (function() { | 34 (function() { |
35 debug('<br>showModal() should center in the viewport.'); | 35 debug('<br>showModal() should center in the viewport.'); |
36 | 36 |
37 dialog.showModal(); | 37 dialog.showModal(); |
38 checkCentered(dialog); | 38 checkCentered(dialog); |
39 reset(); | 39 reset(); |
40 }()); | 40 }()); |
41 | 41 |
42 (function() { | 42 (function() { |
43 debug('<br>The dialog is a positioned element, so the top and bottom should
not have style auto.'); | 43 debug('<br>The computed top and bottom of a centered dialog should still hav
e position auto.'); |
44 | 44 |
45 dialog.style.height = '20px'; | |
46 dialog.showModal(); | 45 dialog.showModal(); |
47 shouldBeEqualToString('window.getComputedStyle(dialog).top', '290px'); | 46 shouldBeEqualToString('window.getComputedStyle(dialog).top', 'auto'); |
48 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', '290px'); | 47 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', 'auto'); |
49 | |
50 dialog.style.height = 'auto'; | |
51 reset(); | 48 reset(); |
52 }()); | 49 }()); |
53 | 50 |
54 (function() { | 51 (function() { |
55 debug('<br>The dialog shold stay centered on scroll.'), | 52 debug('<br>The dialog shold stay centered on scroll.'), |
56 | 53 |
57 dialog.showModal(); | 54 dialog.showModal(); |
58 window.scroll(0, 2 * window.scrollY); | 55 window.scroll(0, 2 * window.scrollY); |
59 checkCentered(dialog); | 56 checkCentered(dialog); |
60 reset(); | 57 reset(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 (function() { | 149 (function() { |
153 debug('<br>A dialog with specified \'top\' should be positioned as usual'); | 150 debug('<br>A dialog with specified \'top\' should be positioned as usual'); |
154 offset = 50; | 151 offset = 50; |
155 dialog.style.top = offset + 'px'; | 152 dialog.style.top = offset + 'px'; |
156 dialog.showModal(); | 153 dialog.showModal(); |
157 shouldBe('dialog.getBoundingClientRect().top', 'offset'); | 154 shouldBe('dialog.getBoundingClientRect().top', 'offset'); |
158 | 155 |
159 reset(); | 156 reset(); |
160 }()); | 157 }()); |
161 </script> | 158 </script> |
OLD | NEW |