blob: a0bdfe9a312c83951d97723194b0bc8fdb29fccd [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body style="margin: 0; padding: 0;">
<div style="margin: 0; width: 300px">
<div id="test" style="width: 200px; height: 200px; margin: 0.5px 1.5px 2.5px 3.5px; background: blue;"></div>
<div id="test2" style="width: 299px; height: 200px; margin: 5px auto; background: blue;"></div>
</div>
<script>
// Fixed width margins.
var style = window.getComputedStyle(document.getElementById('test'));
shouldBe('style.marginTop', "'0.5px'");
shouldBe('style.marginRight', "'1.5px'");
shouldBe('style.marginBottom', "'2.5px'");
shouldBe('style.marginLeft', "'3.5px'");
// Auto left/right margin.
var style = window.getComputedStyle(document.getElementById('test2'));
shouldBe('style.marginLeft', "'0.5px'");
shouldBe('style.marginRight', "'0.5px'");
</script>
</body>
</html>