Skip to content

Commit 5ed4383

Browse files
committed
Add unit tests with invalid calc definitions
1 parent 81143bd commit 5ed4383

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,16 @@ function testCalcNestedInFile() {
415415
$this->assertSame($sExpected, $oDoc->render());
416416
}
417417

418+
function testInvalidCalcInFile() {
419+
$oDoc = $this->parsedStructureForFile('calc-invalid', Settings::create()->withMultibyteSupport(true));
420+
$sExpected = 'div {}
421+
div {}
422+
div {}
423+
div {}
424+
div {}';
425+
$this->assertSame($sExpected, $oDoc->render());
426+
}
427+
418428
function testGridLineNameInFile() {
419429
$oDoc = $this->parsedStructureForFile('grid-linename', Settings::create()->withMultibyteSupport(true));
420430
$sExpected = "div {grid-template-columns: [linename] 100px;}\nspan {grid-template-columns: [linename1 linename2] 100px;}";

tests/files/calc-invalid.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
div{
2+
height: calc (25% - 1em);
3+
}
4+
5+
div{
6+
height: calc
7+
(25% - 1em);
8+
}
9+
10+
div{
11+
height: calc
12+
width: 100px
13+
}
14+
15+
div{
16+
height: -moz-calc;
17+
}
18+
19+
div{
20+
height: calc
21+
;
22+
}

0 commit comments

Comments
 (0)