Skip to content

Add regression test for multiple @function rules with result descriptor#188

Merged
bartveneman merged 1 commit intomainfrom
claude/fix-css-parser-187-s4HNB
Mar 16, 2026
Merged

Add regression test for multiple @function rules with result descriptor#188
bartveneman merged 1 commit intomainfrom
claude/fix-css-parser-187-s4HNB

Conversation

@bartveneman
Copy link
Member

Summary

Added a regression test to verify that multiple @function rules with result: descriptors are all parsed correctly.

Changes

  • Added test case 'multiple @function rules with result: descriptor are all parsed (#187)' to the Core Nodes test suite
  • The test verifies that three consecutive @function rules are all parsed (previously every other rule was being silently dropped)
  • Test validates that each function rule is correctly identified as an AT_RULE with name 'function'
  • Test confirms that each function's block contains exactly one declaration with the result property

Details

This is a regression test for issue #187 where @function blocks containing a result: descriptor caused subsequent @function rules to be skipped during parsing. The test ensures the parser correctly handles multiple function rules in sequence without dropping any of them.

https://claude.ai/code/session_01GRrZ5YkwVpAZqgxAt8sYM8

)

Add a test covering multiple consecutive @function at-rules that each
contain a result: descriptor. In v0.13.3 (before @function support was
added), the parser fell into a rules-only parse path that called
parse_style_rule() on the result: declaration. The selector scanner
would then advance past the closing } and consume the next @function
rule as the style rule body, silently dropping every other @function.

The fix was already in place (added in 0.13.6 via CONDITIONAL_AT_RULES,
then generalised in 0.13.7 so all unknown at-rules use the declarations+
rules+at-rules parse path). This test locks in the correct behaviour.

Closes #187
@codecov-commenter
Copy link

Bundle Report

Bundle size has no change ✅

@bartveneman bartveneman marked this pull request as ready for review March 16, 2026 15:06
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.23%. Comparing base (4c318ae) to head (2fed2e1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #188   +/-   ##
=======================================
  Coverage   95.23%   95.23%           
=======================================
  Files          16       16           
  Lines        2873     2873           
  Branches      806      806           
=======================================
  Hits         2736     2736           
  Misses        137      137           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bartveneman bartveneman merged commit 4f4b5bd into main Mar 16, 2026
4 of 5 checks passed
@bartveneman bartveneman deleted the claude/fix-css-parser-187-s4HNB branch March 16, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants