diff --git a/tests/ParserTest.php b/tests/ParserTest.php index a48ac0e7..dc0371d9 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -1242,6 +1242,37 @@ public function lonelyImport() self::assertSame($sExpected, $oDoc->render()); } + /** + * @test + */ + public function parseForEscapedQuotes() + { + $preParseCss = sprintf( + "%s%s%s%s%s%s%s", + '.fonts-first {font-family: Roboto, "Fira Mono", \"Liberation Serif\";}', + PHP_EOL, + ".font-second {font-family: Roboto, 'Fira Mono', \'Liberation Serif\';}", + PHP_EOL, + '.bgpic-first {background-image: url(\"pic.webp\");}', + PHP_EOL, + ".bgpic-second {background-image: url(\'pic.webp\');}" + ); + $expectedCss = sprintf( + "%s%s%s%s%s%s%s", + '.fonts-first {font-family: Roboto,"Fira Mono","Liberation Serif";}', + PHP_EOL, + '.font-second {font-family: Roboto,"Fira Mono","Liberation Serif";}', + PHP_EOL, + '.bgpic-first {background-image: url("pic.webp");}', + PHP_EOL, + '.bgpic-second {background-image: url("pic.webp");}' + ); + $parser = new Parser($preParseCss); + $document = $parser->parse(); + $postParseCss = $document->render(); + self::assertEquals($expectedCss, $postParseCss); + } + public function escapedSpecialCaseTokens() { $oDoc = $this->parsedStructureForFile('escaped-tokens');