Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <meta charset='utf-8'> |
| 4 | <head> |
| 5 | <script src="../dist/dialog-polyfill.js"></script> |
| 6 | <link rel="stylesheet" type="text/css" href="../dist/dialog-polyfill.css"> |
| 7 | <style> |
| 8 | dialog { |
| 9 | display: none; |
| 10 | height: 50px; |
| 11 | width: 50px; |
| 12 | padding: 0; |
| 13 | margin: 0; |
| 14 | } |
| 15 | |
| 16 | dialog.left { |
| 17 | top: 100px; |
| 18 | left: 100px; |
| 19 | } |
| 20 | |
| 21 | #middle { |
| 22 | top: 100px; |
| 23 | left: 200px; |
| 24 | } |
| 25 | </style> |
| 26 | </head> |
| 27 | <body> |
| 28 | <p>Test that dialogs with an explicit static position don't get auto-centered. |
| 29 | The test passes if there are three boxes aligned in a single row.</p> |
| 30 | <div id="console"></div> |
| 31 | <dialog id="left" class="left"></dialog> |
| 32 | <dialog id="middle"></dialog> |
| 33 | <dialog id="right"></dialog> |
| 34 | <script> |
| 35 | function writeToConsole(s) { |
| 36 | var console = document.getElementById('console'); |
| 37 | var span = document.createElement('span'); |
| 38 | span.textContent = s; |
| 39 | console.appendChild(span); |
| 40 | console.appendChild(document.createElement('br')); |
| 41 | } |
| 42 | |
| 43 | var dialogs = document.querySelectorAll('dialog'); |
| 44 | for (var i = 0; i < dialogs.length; ++i) |
| 45 | dialogPolyfill.registerDialog(dialogs[i]); |
| 46 | |
| 47 | var leftDialog = document.getElementById('left'); |
| 48 | leftDialog.show(); |
| 49 | |
| 50 | var middleDialog = document.getElementById('middle'); |
| 51 | middleDialog.show(); |
| 52 | |
| 53 | var rightDialog = document.getElementById('right'); |
| 54 | rightDialog.style.top = '100px'; |
| 55 | rightDialog.style.left = '300px'; |
| 56 | rightDialog.show(); |
| 57 | </script> |
| 58 | </body> |
| 59 | </html> |