| 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 computed top and bottom of a centered dialog should still hav
e position auto.'); | 43 debug('<br>The dialog is a positioned element, so the top and bottom should
not have style auto.'); |
| 44 | 44 |
| 45 dialog.style.height = '20px'; |
| 45 dialog.showModal(); | 46 dialog.showModal(); |
| 46 shouldBeEqualToString('window.getComputedStyle(dialog).top', 'auto'); | 47 shouldBeEqualToString('window.getComputedStyle(dialog).top', '290px'); |
| 47 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', 'auto'); | 48 shouldBeEqualToString('window.getComputedStyle(dialog).bottom', '290px'); |
| 49 |
| 50 dialog.style.height = 'auto'; |
| 48 reset(); | 51 reset(); |
| 49 }()); | 52 }()); |
| 50 | 53 |
| 51 (function() { | 54 (function() { |
| 52 debug('<br>The dialog shold stay centered on scroll.'), | 55 debug('<br>The dialog shold stay centered on scroll.'), |
| 53 | 56 |
| 54 dialog.showModal(); | 57 dialog.showModal(); |
| 55 window.scroll(0, 2 * window.scrollY); | 58 window.scroll(0, 2 * window.scrollY); |
| 56 checkCentered(dialog); | 59 checkCentered(dialog); |
| 57 reset(); | 60 reset(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 (function() { | 152 (function() { |
| 150 debug('<br>A dialog with specified \'top\' should be positioned as usual'); | 153 debug('<br>A dialog with specified \'top\' should be positioned as usual'); |
| 151 offset = 50; | 154 offset = 50; |
| 152 dialog.style.top = offset + 'px'; | 155 dialog.style.top = offset + 'px'; |
| 153 dialog.showModal(); | 156 dialog.showModal(); |
| 154 shouldBe('dialog.getBoundingClientRect().top', 'offset'); | 157 shouldBe('dialog.getBoundingClientRect().top', 'offset'); |
| 155 | 158 |
| 156 reset(); | 159 reset(); |
| 157 }()); | 160 }()); |
| 158 </script> | 161 </script> |
| OLD | NEW |