Skip to content

Commit

Permalink
[TASK] Add some more tests for parsing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverklee committed Oct 20, 2024
1 parent 9974bbf commit afe1c4c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/RuleSet/DeclarationBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,26 @@ public function orderOfElementsMatchingOriginalOrderAfterExpandingShorthands():
\array_map('strval', $lastDeclarationBlock->getRulesAssoc())
);
}

/**
* @return array<string, array{0: non-empty-string, 1: non-empty-string}>
*/
public static function declarationBlocksWithCommentsProvider(): array
{
return [
'CSS comments with one asterisk' => ['p {color: #000;/* black */}', 'p {color: #000;}'],
'CSS comments with two asterisks' => ['p {color: #000;/** black */}', 'p {color: #000;}'],
];
}

/**
* @test
* @dataProvider declarationBlocksWithCommentsProvider
*/
public function removesCommentsFromRules(string $cssWithComments, string $cssWithoutComments): void
{
$document = (new Parser($cssWithComments))->parse();

self::assertSame($cssWithoutComments, $document->render());
}
}

0 comments on commit afe1c4c

Please sign in to comment.