1 description('Test parsing of the CSS line-snap property.');
3 function test(declaration) {
4 var div = document.createElement("div");
5 div.setAttribute("style", declaration);
6 return div.style.webkitLineSnap;
9 function testComputedStyle(value) {
10 var div = document.createElement("div");
11 document.body.appendChild(div);
12 div.style.setProperty("-webkit-line-snap", value);
13 var webkitFlowComputedValue = getComputedStyle(div).getPropertyValue("-webkit-line-snap");
14 document.body.removeChild(div);
15 return webkitFlowComputedValue;
18 function testInherited(parentValue) {
19 var parentDiv = document.createElement("div");
20 document.body.appendChild(parentDiv);
21 parentDiv.style.setProperty("-webkit-line-snap", parentValue);
23 var childDiv = document.createElement("div");
24 parentDiv.appendChild(childDiv);
26 var childWebKitFlowComputedValue = getComputedStyle(childDiv).getPropertyValue("-webkit-line-snap");
28 parentDiv.removeChild(childDiv);
29 document.body.removeChild(parentDiv);
31 return childWebKitFlowComputedValue;
34 shouldBeEqualToString('test("-webkit-line-snap: none")', "none");
35 shouldBeEqualToString('test("-webkit-line-snap: baseline")', "baseline");
36 shouldBeEqualToString('test("-webkit-line-snap: contain")', "contain");
37 shouldBeEqualToString('test("-webkit-line-snap: ;")', "");
38 shouldBeEqualToString('test("-webkit-line-snap: 1")', "");
39 shouldBeEqualToString('test("-webkit-line-snap: 1.2")', "");
40 shouldBeEqualToString('test("-webkit-line-snap: -1")', "");
41 shouldBeEqualToString('test("-webkit-line-snap: 12px")', "");
43 shouldBeEqualToString('testComputedStyle("none")', "none");
44 shouldBeEqualToString('testComputedStyle("")', "none");
45 shouldBeEqualToString('testComputedStyle("12px")', "none");
47 shouldBeEqualToString('testInherited("none")', "none");
48 shouldBeEqualToString('testInherited("baseline")', "baseline");
49 shouldBeEqualToString('testInherited("contain")', "contain");