File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -247,4 +247,35 @@ public function testLintNotValidCssFile()
247247 $ errors
248248 );
249249 }
250+
251+ public function testLintFontFaceWithSpecificProperties ()
252+ {
253+ // This test verifies the fix for the @font-face at-rule parsing issue
254+ // where the trailing brace was incorrectly included in the at-rule name,
255+ // causing valid @font-face properties to be flagged as invalid.
256+
257+ // Arrange
258+ $ css = '@font-face{font-family:Poppins;font-display:swap;src:url(font.woff2);unicode-range:U+0900-097F} ' ;
259+
260+ // Act
261+ $ errors = iterator_to_array ($ this ->linter ->lintString ($ css ), false );
262+
263+ // Assert
264+ $ this ->assertEmpty ($ errors , 'Valid @font-face properties should not produce lint errors ' );
265+ }
266+
267+ public function testLintFontFaceWithInvalidProperty ()
268+ {
269+ // This test ensures that invalid properties are still caught within @font-face blocks
270+
271+ // Arrange
272+ $ css = '@font-face{font-family:Poppins;invalid-property:value} ' ;
273+
274+ // Act
275+ $ errors = iterator_to_array ($ this ->linter ->lintString ($ css ), false );
276+
277+ // Assert
278+ $ this ->assertCount (1 , $ errors , 'Invalid @font-face property should produce exactly one lint error ' );
279+ $ this ->assertStringContains ('invalid-property ' , $ errors [0 ]->getMessage ());
280+ }
250281}
You can’t perform that action at this time.
0 commit comments