-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from Konnng/master
Fix regex in resolve-value.js to allow nested CSS functions
- Loading branch information
Showing
13 changed files
with
170 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
test/fixtures/nested-inside-calc-func-with-fallback-var.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
:root { | ||
--some-width: 150px; | ||
--some-other-width: 50px; | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - var(--missing, var(--some-width, 100px))); | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - var(--missing, var(--missing2, 100px))); | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - var(--missing, var(--missing2, var(--some-other-width)))); | ||
} |
11 changes: 11 additions & 0 deletions
11
test/fixtures/nested-inside-calc-func-with-fallback-var.expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.box-foo { | ||
width: calc(58.3333333333% - 150px); | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - 100px); | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - 50px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:root { | ||
--some-width: 150px; | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - var(--some-width, 100px)); | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - var(--missing, 100px)); | ||
} |
7 changes: 7 additions & 0 deletions
7
test/fixtures/nested-inside-calc-func-with-fallback.expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.box-foo { | ||
width: calc(58.3333333333% - 150px); | ||
} | ||
|
||
.box-foo { | ||
width: calc(58.3333333333% - 100px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
:root { | ||
--some-width: 150px; | ||
--some-other-width: 50px; | ||
} | ||
|
||
.box-foo { | ||
width: calc(1000% - var(--some-width)); | ||
} | ||
|
||
.box-foo { | ||
width: calc(1000% - var(--missing-width)); | ||
} | ||
|
||
.box-foo { | ||
width: calc(var(--some-width) - var(--some-other-width)); | ||
} | ||
|
||
.box-foo { | ||
--widthA: 100px; | ||
--widthB: calc(var(--widthA) / 2); | ||
--widthC: calc(var(--widthB) / 2); | ||
width: var(--widthC); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.box-foo { | ||
width: calc(1000% - 150px); | ||
} | ||
|
||
.box-foo { | ||
width: undefined; | ||
} | ||
|
||
.box-foo { | ||
width: calc(150px - 50px); | ||
} | ||
|
||
.box-foo { | ||
width: calc(calc(100px / 2) / 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
:root { | ||
--some-color: red; | ||
} | ||
.box-foo { | ||
background-color: color(var(--missing, white)); | ||
} | ||
.box-foo { | ||
background-color: color(var(--some-color, white)); | ||
} |
6 changes: 6 additions & 0 deletions
6
test/fixtures/nested-inside-other-func-with-fallback.expected.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.box-foo { | ||
background-color: color(white); | ||
} | ||
.box-foo { | ||
background-color: color(red); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
:root { | ||
--some-color: red; | ||
--some-opacity: 0.3; | ||
} | ||
|
||
.box-foo { | ||
background-color: color(var(--some-color)); | ||
} | ||
|
||
.box-foo { | ||
background-color: color(var(--some-color, white)); | ||
background-color: rgba(255, 0, 0, var(--some-opacity)); | ||
} | ||
|
||
.box-foo { | ||
background-color: hsla(120,100%,50%, var(--missing-opacity)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
.box-foo { | ||
background-color: color(white); | ||
background-color: color(red); | ||
} | ||
|
||
.box-foo { | ||
background-color: rgba(255, 0, 0, 0.3); | ||
} | ||
|
||
.box-foo { | ||
background-color: undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters