Skip to content

Conversation

@scq
Copy link
Contributor

@scq scq commented Dec 1, 2025

Adds support for CSS container queries.

https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Containment/Container_queries

@container (width > 700px) {
  .card h2 {
    font-size: 2em;
  }
}

@coveralls
Copy link

coveralls commented Dec 1, 2025

Coverage Status

coverage: 59.658%. remained the same
when pulling 45830cd on totara:container-queries
into fe29992 on MyIntervals:main.

Copy link
Collaborator

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Could you also add a test to confirm the feature - ideally introducing an AtRuleTest TestCase? And add an entry to CHANGELOG.md?

Thanks.

@scq scq force-pushed the container-queries branch from 013f3ef to 61977f9 Compare December 2, 2025 00:15
@scq
Copy link
Contributor Author

scq commented Dec 2, 2025

Thanks! Added a test here, it's a little difficult to test being an interface so it just checks the value of the property, but open to any better ideas you have.

Copy link
Collaborator

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again.

it's a little difficult to test being an interface so it just checks the value of the property

My apologies. When looking at the diffs without full context, I was thinking that AtRule was a class.

The test you have added I think a is good to check to have for the internal behaviour (and fulfills the criteria: fails without the change; passes with). Though it seems PHPStan does not like a @covers annotation for an interface.

but open to any better ideas you have.

I've now done a bit of digging around the code base and existing tests and found that we have tests/CSSList/AtRuleBlockListTest.php. This has a test method parsesSyntacticallyCorrectAtRuleInStrictMode which checks that the at-rule is not discarded.

So I think to test the external beviour, it would good to have the provideSyntacticallyCorrectAtRule() data provider also provide a valid @contianer rule, which I expect would fail without the change. I think that would be sufficient (it's all we have for the other at-rules).

@oliverklee, do you have any other comments?

*/
public function blockRulesConstantIsCorrect(): void
{
self::assertEqualsCanonicalizing(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good choice of assert method - it allows the components to be in any order.

@JakeQZ JakeQZ requested a review from oliverklee December 2, 2025 01:29
@scq scq force-pushed the container-queries branch from 61977f9 to 45830cd Compare December 2, 2025 02:21
@scq
Copy link
Contributor Author

scq commented Dec 2, 2025

Aha! Thanks, good find -- I've added a @container entry to the provideSyntacticallyCorrectAtRule data provider.

Copy link
Collaborator

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now. Thanks <3

@JakeQZ JakeQZ merged commit 8be4011 into MyIntervals:main Dec 2, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants