Skip to content

Commit 6500cd5

Browse files
Copilotneilime
andcommitted
Add integration tests for @font-face at-rule parsing fix
Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent 8d29dba commit 6500cd5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/TestSuite/LinterTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)