4 <script src=
"../../resources/js-test.js"></script>
6 <body style=
"margin: 0; padding: 0;">
7 <div style=
"margin: 0; width: 700px; margin: 10px; background: black; overflow: hidden;">
8 <div id=
"test" style=
"width: 697px; height: 200px; background-color: red; margin: 0 auto"></div>
11 var testEl
= document
.getElementById('test');
12 var testRect
= testEl
.getBoundingClientRect();
13 var parentRect
= testEl
.parentElement
.getBoundingClientRect();
15 var expectedMarginWidth
= String((parentRect
.width
- testRect
.width
) / 2);
16 shouldBe('testRect.left - parentRect.left', expectedMarginWidth
);
17 shouldBe('parentRect.right - testRect.right', expectedMarginWidth
);