Skip to content

Commit

Permalink
Readme update & new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tib committed Nov 21, 2021
1 parent 1616699 commit a844dbd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let css = Stylesheet {
}
}

print(StylesheetRenderer().render(css))
print(StylesheetRenderer(minify: false, indent: 4).render(css))
```

## Credits & references
Expand Down
35 changes: 33 additions & 2 deletions Tests/SwiftCssTests/SwiftCssTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,39 @@ import XCTest

final class SwiftCssTests: XCTestCase {

func testMinifiedStylesheet() {
let css = Stylesheet {
Charset("UTF-8")
Media {
Root {
Margin(horizontal: .px(8.5), vertical: .px(8))
Padding(horizontal: .px(8), vertical: .px(8))
}
}
}
XCTAssertEqual(StylesheetRenderer(minify: true, indent: 2).render(css), #"@charset "UTF-8";:root{margin:8.5px 8px;padding:8px 8px}"#)
}

func testCustomIndentStylesheet() {
let css = Stylesheet {
Charset("UTF-8")
Media {
Root {
Margin(horizontal: .px(8.5), vertical: .px(8))
Padding(horizontal: .px(8), vertical: .px(8))
}
}
}
print(StylesheetRenderer(indent: 2).render(css))
XCTAssertEqual(StylesheetRenderer(indent: 2).render(css), #"""
@charset "UTF-8";
:root {
margin: 8.5px 8px;
padding: 8px 8px;
}
"""#)
}

func testStylesheet() {
let css = Stylesheet {
Charset("UTF-8")
Expand Down Expand Up @@ -62,8 +95,6 @@ final class SwiftCssTests: XCTestCase {
"""#)
}



func testVariable() {
let css = Stylesheet {
Media {
Expand Down

0 comments on commit a844dbd

Please sign in to comment.