Skip to content

Commit

Permalink
Merge pull request #21 from kristerkari/feature/support-viewport-units
Browse files Browse the repository at this point in the history
Add support for parsing viewport units
  • Loading branch information
kristerkari committed May 9, 2018
2 parents ba0e529 + 8facfdc commit f3c11e6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dependencies": {
"css": "^2.2.1",
"css-mediaquery": "^0.1.2",
"css-to-react-native": "^2.1.2"
"css-to-react-native": "^2.2.0"
},
"repository": {
"type": "git",
Expand Down
28 changes: 28 additions & 0 deletions src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,34 @@ describe("rem unit", () => {
});
});

describe("viewport units", () => {
it("should transform viewport units", () => {
expect(
transform(`
.test {
font-size: 1vw;
line-height: 2vh;
padding: 1vmax;
margin: 1vmin;
}
`),
).toEqual({
test: {
fontSize: "1vw",
lineHeight: "2vh",
marginBottom: "1vmin",
marginLeft: "1vmin",
marginRight: "1vmin",
marginTop: "1vmin",
paddingBottom: "1vmax",
paddingLeft: "1vmax",
paddingRight: "1vmax",
paddingTop: "1vmax",
},
});
});
});

describe("media queries", () => {
it("transforms media queries", () => {
expect(
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1068,9 +1068,9 @@ css-mediaquery@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/css-mediaquery/-/css-mediaquery-0.1.2.tgz#6a2c37344928618631c54bd33cedd301da18bea0"

css-to-react-native@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.1.2.tgz#c06d628467ef961c85ec358a90f3c87469fb0095"
css-to-react-native@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/css-to-react-native/-/css-to-react-native-2.2.0.tgz#d524ef7f39a2747a8914e86563669ba35b7cf2e7"
dependencies:
css-color-keywords "^1.0.0"
fbjs "^0.8.5"
Expand Down

0 comments on commit f3c11e6

Please sign in to comment.