Skip to content

Commit 75ac1ed

Browse files
author
Richard Feldman
committed
Test multi-descendent stylesheet
1 parent cd8db88 commit 75ac1ed

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

test/Fixtures.elm

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,34 @@ divWidthHeight =
1818
|-| height 50 px
1919

2020

21+
multiDescendent : Style CssClasses CssIds
22+
multiDescendent =
23+
stylesheet
24+
|%|= [ html, body ]
25+
|-| boxSizing borderBox
26+
|-| display none
27+
28+
|>%| div
29+
|-| width 100 pct
30+
|-| height 100 pct
31+
32+
|%|= [ h1, h2 ]
33+
|-| padding 0 px
34+
|-| margin 0 px
35+
36+
|>%|= [ h3, h4 ]
37+
|-| width 100 pct
38+
|-| height 100 pct
39+
40+
|%| span
41+
|-| padding 10 px
42+
|-| margin 11 px
43+
44+
|>%|= [ h2, h1 ]
45+
|-| width 1 px
46+
|-| height 2 pct
47+
48+
2149
dreamwriter : Style CssClasses CssIds
2250
dreamwriter =
2351
stylesheet

test/Tests.elm

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ all =
1717
suite "elm-stylesheets"
1818
[ divWidthHeight
1919
, dreamwriter
20+
, multiDescendent
2021
]
2122

2223

@@ -75,9 +76,53 @@ body > div {
7576
background-color: rgb(100, 90, 128);
7677
color: rgb(40, 35, 76);
7778
}
78-
"""
79+
"""
7980
in
8081
suite "Sample stylesheet from Dreamwriter"
8182
[ test "pretty prints the expected output" <|
8283
assertEqual output (prettyPrint input)
8384
]
85+
86+
multiDescendent : Test
87+
multiDescendent =
88+
let
89+
input =
90+
Fixtures.multiDescendent
91+
92+
output =
93+
String.trim """
94+
html, body {
95+
box-sizing: border-box;
96+
display: none;
97+
}
98+
99+
html, body > div {
100+
width: 100%;
101+
height: 100%;
102+
}
103+
104+
h1, h2 {
105+
padding: 0px;
106+
margin: 0px;
107+
}
108+
109+
h1, h2 > h3, h1, h2 > h4 {
110+
width: 100%;
111+
height: 100%;
112+
}
113+
114+
span {
115+
padding: 10px;
116+
margin: 11px;
117+
}
118+
119+
span > h2, span > h1 {
120+
width: 1px;
121+
height: 2%;
122+
}
123+
"""
124+
in
125+
suite "Multi-descendent stylesheet"
126+
[ test "pretty prints the expected output" <|
127+
assertEqual output (prettyPrint input)
128+
]

0 commit comments

Comments
 (0)