Skip to content

Commit 1c29828

Browse files
committed
Add test cases for nested calc expressions
1 parent aa39efd commit 1c29828

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,12 @@ function testCalcInFile() {
395395
$this->assertSame($sExpected, $oDoc->render());
396396
}
397397

398+
function testCalcNestedInFile() {
399+
$oDoc = $this->parsedStructureForFile('calc-nested', Settings::create()->withMultibyteSupport(true));
400+
$sExpected = '.test {font-size: calc(( 3 * 4px ) + -2px);top: calc(200px - calc(20 * 3px));}';
401+
$this->assertSame($sExpected, $oDoc->render());
402+
}
403+
398404
function testGridLineNameInFile() {
399405
$oDoc = $this->parsedStructureForFile('grid-linename', Settings::create()->withMultibyteSupport(true));
400406
$sExpected = "div {grid-template-columns: [linename] 100px;}\nspan {grid-template-columns: [linename1 linename2] 100px;}";

tests/files/calc-nested.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.test {
2+
font-size: calc((3 * 4px) + -2px);
3+
top: calc(200px - calc(20 * 3px));
4+
}

0 commit comments

Comments
 (0)