Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / line-grid / script-tests / line-align-parsing.js
1 description('Test parsing of the CSS line-snap property.');
2
3 function test(declaration) {
4     var div = document.createElement("div");
5     div.setAttribute("style", declaration);
6     return div.style.webkitLineAlign;
7 }
8
9 function testComputedStyle(value) {
10     var div = document.createElement("div");
11     document.body.appendChild(div);
12     div.style.setProperty("-webkit-line-align", value);
13     var webkitFlowComputedValue = getComputedStyle(div).getPropertyValue("-webkit-line-align");
14     document.body.removeChild(div);
15     return webkitFlowComputedValue;
16 }
17
18 function testInherited(parentValue) {
19     var parentDiv = document.createElement("div");
20     document.body.appendChild(parentDiv);
21     parentDiv.style.setProperty("-webkit-line-align", parentValue);
22
23     var childDiv = document.createElement("div");
24     parentDiv.appendChild(childDiv);
25
26     var childWebKitFlowComputedValue = getComputedStyle(childDiv).getPropertyValue("-webkit-line-align");
27
28     parentDiv.removeChild(childDiv);
29     document.body.removeChild(parentDiv);
30
31     return childWebKitFlowComputedValue;
32 }
33
34 shouldBeEqualToString('test("-webkit-line-align: none")', "none");
35 shouldBeEqualToString('test("-webkit-line-align: edges")', "edges");
36 shouldBeEqualToString('test("-webkit-line-align: ;")', "");
37 shouldBeEqualToString('test("-webkit-line-align: 1")', "");
38 shouldBeEqualToString('test("-webkit-line-align: 1.2")', "");
39 shouldBeEqualToString('test("-webkit-line-align: -1")', "");
40 shouldBeEqualToString('test("-webkit-line-align: 12px")', "");
41
42 shouldBeEqualToString('testComputedStyle("none")', "none");
43 shouldBeEqualToString('testComputedStyle("")', "none");
44 shouldBeEqualToString('testComputedStyle("12px")', "none");
45
46 shouldBeEqualToString('testInherited("none")', "none");
47 shouldBeEqualToString('testInherited("edges")', "edges");
48