Skip to content

Commit

Permalink
Add escaped quotes parsing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
petkodimitrov committed Mar 29, 2024
1 parent aa00e4c commit 6178a81
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 6178a81

Please sign in to comment.