[CSS Exclusions] Update wrap-margin/padding to shape-margin/padding
[WebKit-https.git] / LayoutTests / fast / exclusions / script-tests / shape-margin-parsing.js
1 description('Test parsing of the CSS shape-margin property.');
2
3 if (window.internals)
4     window.internals.settings.setCSSExclusionsEnabled(true);
5
6 function test(declaration) {
7     var div = document.createElement("div");
8     div.setAttribute("style", declaration);
9     return div.style.webkitShapeMargin;
10 }
11
12 function testComputedStyle(value) {
13     var div = document.createElement("div");
14     document.body.appendChild(div);
15     div.style.setProperty("-webkit-shape-margin", value);
16     var webkitShapeMarginComputedValue = getComputedStyle(div).getPropertyValue("-webkit-shape-margin");
17     document.body.removeChild(div);
18     return webkitShapeMarginComputedValue;
19 }
20
21 function testNotInherited(parentValue, childValue) {
22     var parentDiv = document.createElement("div");
23     document.body.appendChild(parentDiv);
24     parentDiv.style.setProperty("-webkit-shape-margin", parentValue);
25
26     var childDiv = document.createElement("div");
27     parentDiv.appendChild(childDiv);
28     childDiv.style.setProperty("-webkit-shape-margin", childValue);
29
30     var childWebKitShapeMarginComputedValue = getComputedStyle(childDiv).getPropertyValue("-webkit-shape-margin");
31
32     parentDiv.removeChild(childDiv);
33     document.body.removeChild(parentDiv);
34
35     return childWebKitShapeMarginComputedValue;
36 }
37
38 shouldBeEqualToString('test("-webkit-shape-margin: 0")', "0px");
39 shouldBeEqualToString('test("-webkit-shape-margin: 1.5ex")', "1.5ex");
40 shouldBeEqualToString('test("-webkit-shape-margin: 2em")', "2em");
41 shouldBeEqualToString('test("-webkit-shape-margin: 2.5in")', "2.5in");
42 shouldBeEqualToString('test("-webkit-shape-margin: 3cm")', "3cm");
43 shouldBeEqualToString('test("-webkit-shape-margin: 3.5mm")', "3.5mm");
44 shouldBeEqualToString('test("-webkit-shape-margin: 4pt")', "4pt");
45 shouldBeEqualToString('test("-webkit-shape-margin: 4.5pc")', "4.5pc");
46 shouldBeEqualToString('test("-webkit-shape-margin: 5px")', "5px");
47
48 shouldBeEqualToString('test("-webkit-shape-margin: -5px")', "");
49 shouldBeEqualToString('test("-webkit-shape-margin: auto")', "");
50 shouldBeEqualToString('test("-webkit-shape-margin: \'string\'")', "");
51 shouldBeEqualToString('test("-webkit-shape-margin: 120%")', "");
52
53 shouldBeEqualToString('testComputedStyle("0")', "0px");
54 shouldBeEqualToString('testComputedStyle("1px")', "1px");
55 shouldBeEqualToString('testComputedStyle("-5em")', "0px");
56 shouldBeEqualToString('testComputedStyle("identifier")', "0px");
57 shouldBeEqualToString('testComputedStyle("\'string\'")', "0px");
58
59 shouldBeEqualToString('testNotInherited("0", "0")', "0px");
60 shouldBeEqualToString('testNotInherited("0", "1px")', "1px");
61 shouldBeEqualToString('testNotInherited("1px", "-1em")', "0px");
62 shouldBeEqualToString('testNotInherited("2px", "1px")', "1px");