Skip to content

Commit a06e5bb

Browse files
committed
Add unit test for invalid selectors
1 parent 4f8da97 commit a06e5bb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,14 @@ function testUnmatchedBracesInFile() {
432432
$this->assertSame($sExpected, $oDoc->render());
433433
}
434434

435+
function testInvalidSelectorsInFile() {
436+
$oDoc = $this->parsedStructureForFile('invalid-selectors', Settings::create()->withMultibyteSupport(true));
437+
$sExpected = '@keyframes mymove {from {top: 0px;}}
438+
#test {color: white;background: green;}
439+
#test {display: block;background: white;color: black;}';
440+
$this->assertSame($sExpected, $oDoc->render());
441+
}
442+
435443
/**
436444
* @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
437445
*/

tests/files/invalid-selectors.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@keyframes mymove {
2+
from { top: 0px; }
3+
}
4+
5+
#test {
6+
color: white;
7+
background: green;
8+
}
9+
10+
body
11+
background: black;
12+
}
13+
14+
#test {
15+
display: block;
16+
background: red;
17+
color: white;
18+
}
19+
#test {
20+
display: block;
21+
background: white;
22+
color: black;
23+
}
24+

0 commit comments

Comments
 (0)