Skip to content

Commit afe1c4c

Browse files
committed
[TASK] Add some more tests for parsing comments
1 parent 9974bbf commit afe1c4c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,4 +428,26 @@ public function orderOfElementsMatchingOriginalOrderAfterExpandingShorthands():
428428
\array_map('strval', $lastDeclarationBlock->getRulesAssoc())
429429
);
430430
}
431+
432+
/**
433+
* @return array<string, array{0: non-empty-string, 1: non-empty-string}>
434+
*/
435+
public static function declarationBlocksWithCommentsProvider(): array
436+
{
437+
return [
438+
'CSS comments with one asterisk' => ['p {color: #000;/* black */}', 'p {color: #000;}'],
439+
'CSS comments with two asterisks' => ['p {color: #000;/** black */}', 'p {color: #000;}'],
440+
];
441+
}
442+
443+
/**
444+
* @test
445+
* @dataProvider declarationBlocksWithCommentsProvider
446+
*/
447+
public function removesCommentsFromRules(string $cssWithComments, string $cssWithoutComments): void
448+
{
449+
$document = (new Parser($cssWithComments))->parse();
450+
451+
self::assertSame($cssWithoutComments, $document->render());
452+
}
431453
}

0 commit comments

Comments
 (0)