Skip to content

Add tests for container queries with name-only syntax#204

Merged
bartveneman merged 1 commit intomainfrom
claude/optional-container-conditions-T8SLW
Mar 27, 2026
Merged

Add tests for container queries with name-only syntax#204
bartveneman merged 1 commit intomainfrom
claude/optional-container-conditions-T8SLW

Conversation

@bartveneman
Copy link
Copy Markdown
Member

Summary

Added test coverage for parsing CSS container queries that specify only a container name without conditions, which is valid according to the CSS Containment specification.

Changes

  • Added test case for simple container query with a single identifier name (@container sidebar)
  • Added test case for container query with hyphenated container name (@container my-layout)
  • Both tests verify that the parser correctly identifies the container name as an IDENTIFIER node within the CONTAINER_QUERY node

Details

These tests validate that the parser correctly handles the optional container conditions syntax. According to the CSS spec (referenced in the test comments), container conditions are optional when a container name is specified. The tests ensure that:

  1. A container query with just a name is parsed as a CONTAINER_QUERY node
  2. The container name is correctly extracted as an IDENTIFIER child node
  3. Both simple and hyphenated container names are handled properly

https://claude.ai/code/session_01Ta7yWNuyFFE523YPGg46F7

…ons)

Container conditions are now optional per the updated CSS spec. This adds
test coverage proving that `@container sidebar { }` and similar patterns
with only a container name (no condition block) parse correctly.

See https://bugzilla.mozilla.org/show_bug.cgi?id=2016474

https://claude.ai/code/session_01Ta7yWNuyFFE523YPGg46F7
@bartveneman bartveneman merged commit 0d9d4cc into main Mar 27, 2026
4 of 5 checks passed
@bartveneman bartveneman deleted the claude/optional-container-conditions-T8SLW branch March 27, 2026 15:10
@codecov-commenter
Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.24%. Comparing base (b5706aa) to head (0c02948).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #204   +/-   ##
=======================================
  Coverage   95.24%   95.24%           
=======================================
  Files          16       16           
  Lines        2881     2881           
  Branches      806      806           
=======================================
  Hits         2744     2744           
  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.

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