chromium/third_party/blink/web_tests/fast/css/getComputedStyle/getComputedStyle-margin-shorthand.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>

description("Tests that the margin shorthand is computed properly.")

var testContainer = document.createElement("div");
testContainer.contentEditable = true;
document.body.appendChild(testContainer);

testContainer.innerHTML = '<div style="width:100px;height:100px"><div id="test">hello</div></div>';

e = document.getElementById('test');
computedStyle = window.getComputedStyle(e, null);

e.style.margin = "10px 5px 4px 3px";
shouldBe("computedStyle.getPropertyValue('margin')", "'10px 5px 4px 3px'");

e.style.margin = "4em 5em 6em 7em";
shouldBe("computedStyle.getPropertyValue('margin')", "'64px 80px 96px 112px'");

e.style.margin = "5% 6% 7% 8%";
shouldBe("computedStyle.getPropertyValue('margin')", "'5px 6px 7px 8px'");

document.body.removeChild(testContainer);

</script>
</body>
</html>