Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
|
esprehn
2014/06/20 01:32:37
ditto to all of these tests.
falken
2014/06/20 01:49:54
Done.
| |
| 3 <head> | |
| 4 <link href="resources/dialog-layout.css" rel="stylesheet"> | |
| 5 <script src="../../../resources/js-test.js"></script> | |
| 6 </head> | |
| 7 <body> | |
| 8 <div id="absolute-div"> | |
| 9 <div id="relative-div"> | |
| 10 <dialog id="dialog">It is my dialog.</dialog> | |
| 11 </div> | |
| 12 </div> | |
| 13 </body> | |
| 14 <script> | |
| 15 description('Tests layout of non-modal dialogs.'); | |
| 16 | |
| 17 dialog = document.querySelector('#dialog'); | |
| 18 div = document.querySelector('#div-dialog'); | |
| 19 relativeContainer = document.querySelector('#relative-div'); | |
| 20 offset = 50; | |
| 21 dialog.style.top = offset + 'px'; | |
| 22 dialog.style.left = offset + 'px'; | |
| 23 | |
| 24 (function() { | |
| 25 debug('<br>Test absolute position'); | |
| 26 dialog.style.position = 'absolute'; | |
| 27 dialog.show(); | |
| 28 shouldBe('dialog.getBoundingClientRect().top', 'relativeContainer.getBoundin gClientRect().top + offset'); | |
| 29 shouldBe('dialog.getBoundingClientRect().left', 'relativeContainer.getBoundi ngClientRect().left + offset'); | |
| 30 }()); | |
| 31 | |
| 32 (function() { | |
| 33 debug('<br>Test static position'); | |
| 34 dialog.style.position = 'static'; | |
| 35 dialog.show(); | |
| 36 shouldBe('dialog.getBoundingClientRect().top', 'relativeContainer.getBoundin gClientRect().top'); | |
| 37 shouldBe('dialog.getBoundingClientRect().left', 'relativeContainer.getBoundi ngClientRect().left'); | |
| 38 dialog.close(); | |
| 39 }()); | |
| 40 | |
| 41 (function() { | |
| 42 debug('<br>Test relative position'); | |
| 43 dialog.style.position = 'relative'; | |
| 44 dialog.show(); | |
| 45 shouldBe('dialog.getBoundingClientRect().top', 'relativeContainer.getBoundin gClientRect().top + offset'); | |
| 46 shouldBe('dialog.getBoundingClientRect().left', 'relativeContainer.getBoundi ngClientRect().left + offset'); | |
| 47 dialog.close(); | |
| 48 }()); | |
| 49 | |
| 50 (function() { | |
| 51 debug('<br>Test fixed position'); | |
| 52 dialog.style.position = 'fixed'; | |
| 53 dialog.show(); | |
| 54 shouldBe('dialog.getBoundingClientRect().top', 'offset'); | |
| 55 shouldBe('dialog.getBoundingClientRect().left', 'offset'); | |
| 56 dialog.close(); | |
| 57 }()); | |
| 58 </script> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |