Skip to content

Commit ee1f8fe

Browse files
committed
Import the tests from PR MyIntervals#174
1 parent 64f397c commit ee1f8fe

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

tests/Sabberworm/CSS/ParserTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,4 +802,14 @@ function testLonelyImport() {
802802
$sExpected = "@import url(\"example.css\") only screen and (max-width: 600px);";
803803
$this->assertSame($sExpected, $oDoc->render());
804804
}
805+
806+
function testEscapedSpecialCaseTokens() {
807+
$oDoc = $this->parsedStructureForFile('escaped-tokens');
808+
$contents = $oDoc->getContents();
809+
$rules = $contents[0]->getRules();
810+
$urlRule = $rules[0];
811+
$calcRule = $rules[1];
812+
$this->assertEquals(true, is_a($urlRule->getValue(), '\Sabberworm\CSS\Value\URL'));
813+
$this->assertEquals(true, is_a($calcRule->getValue(), '\Sabberworm\CSS\Value\CalcFunction'));
814+
}
805815
}

tests/files/escaped-tokens.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Special case function-like tokens, with an escape backslash followed by a non-newline and non-hex digit character, should be parsed as the appropriate \Sabberworm\CSS\Value\ type
3+
*/
4+
body {
5+
background: u\rl("//example.org/picture.jpg");
6+
height: ca\lc(100% - 1px);
7+
}

0 commit comments

Comments
 (0)