File tree 2 files changed +34
-3
lines changed
2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ let css = Stylesheet {
36
36
}
37
37
}
38
38
39
- print (StylesheetRenderer ().render (css))
39
+ print (StylesheetRenderer (minify : false , indent : 4 ).render (css))
40
40
```
41
41
42
42
## Credits & references
Original file line number Diff line number Diff line change @@ -10,6 +10,39 @@ import XCTest
10
10
11
11
final class SwiftCssTests : XCTestCase {
12
12
13
+ func testMinifiedStylesheet( ) {
14
+ let css = Stylesheet {
15
+ Charset ( " UTF-8 " )
16
+ Media {
17
+ Root {
18
+ Margin ( horizontal: . px( 8.5 ) , vertical: . px( 8 ) )
19
+ Padding ( horizontal: . px( 8 ) , vertical: . px( 8 ) )
20
+ }
21
+ }
22
+ }
23
+ XCTAssertEqual ( StylesheetRenderer ( minify: true , indent: 2 ) . render ( css) , #"@charset "UTF-8";:root{margin:8.5px 8px;padding:8px 8px}"# )
24
+ }
25
+
26
+ func testCustomIndentStylesheet( ) {
27
+ let css = Stylesheet {
28
+ Charset ( " UTF-8 " )
29
+ Media {
30
+ Root {
31
+ Margin ( horizontal: . px( 8.5 ) , vertical: . px( 8 ) )
32
+ Padding ( horizontal: . px( 8 ) , vertical: . px( 8 ) )
33
+ }
34
+ }
35
+ }
36
+ print ( StylesheetRenderer ( indent: 2 ) . render ( css) )
37
+ XCTAssertEqual ( StylesheetRenderer ( indent: 2 ) . render ( css) , #"""
38
+ @charset "UTF-8";
39
+ :root {
40
+ margin: 8.5px 8px;
41
+ padding: 8px 8px;
42
+ }
43
+ """# )
44
+ }
45
+
13
46
func testStylesheet( ) {
14
47
let css = Stylesheet {
15
48
Charset ( " UTF-8 " )
@@ -62,8 +95,6 @@ final class SwiftCssTests: XCTestCase {
62
95
"""# )
63
96
}
64
97
65
-
66
-
67
98
func testVariable( ) {
68
99
let css = Stylesheet {
69
100
Media {
You can’t perform that action at this time.
0 commit comments