summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-padding-shorthand.html
blob: 86ff898bb43ce66024ab2872129fb46de4f67942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>

description("Tests that the padding 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.padding = "10px 5px 4px 3px";
shouldBe("computedStyle.getPropertyValue('padding')", "'10px 5px 4px 3px'");

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

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

document.body.removeChild(testContainer);

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