2 <link href=
"resources/dialog-layout.css" rel=
"stylesheet">
3 <script src=
"../../../resources/js-test.js"></script>
4 <div id=
"absolute-div">
5 <div id=
"relative-div">
6 <dialog id=
"dialog">It is my dialog.
</dialog>
10 description('Tests layout of non-modal dialogs.');
12 dialog
= document
.querySelector('#dialog');
13 div
= document
.querySelector('#div-dialog');
14 relativeContainer
= document
.querySelector('#relative-div');
16 dialog
.style
.top
= offset
+ 'px';
17 dialog
.style
.left
= offset
+ 'px';
20 debug('<br>Test absolute position');
21 dialog
.style
.position
= 'absolute';
23 shouldBe('dialog.getBoundingClientRect().top', 'relativeContainer.getBoundingClientRect().top + offset');
24 shouldBe('dialog.getBoundingClientRect().left', 'relativeContainer.getBoundingClientRect().left + offset');
28 debug('<br>Test static position');
29 dialog
.style
.position
= 'static';
31 shouldBe('dialog.getBoundingClientRect().top', 'relativeContainer.getBoundingClientRect().top');
32 shouldBe('dialog.getBoundingClientRect().left', 'relativeContainer.getBoundingClientRect().left');
37 debug('<br>Test relative position');
38 dialog
.style
.position
= 'relative';
40 shouldBe('dialog.getBoundingClientRect().top', 'relativeContainer.getBoundingClientRect().top + offset');
41 shouldBe('dialog.getBoundingClientRect().left', 'relativeContainer.getBoundingClientRect().left + offset');
46 debug('<br>Test fixed position');
47 dialog
.style
.position
= 'fixed';
49 shouldBe('dialog.getBoundingClientRect().top', 'offset');
50 shouldBe('dialog.getBoundingClientRect().left', 'offset');