Repository navigation
[BUGFIX] Resolve issue with empty default value for var() - #1659
Conversation
JakeQZ
left a comment
There was a problem hiding this comment.
Thanks again for another excellent contribution; you have been quite prolific, @samuil-banti-wpenigne <3.
The code changes look near-perfect. But I think the tests could be extended and improved. See individual comments.
| public function parsesEmptyVarFallback(): void | ||
| { | ||
| $parserState = new ParserState('var(--w,)', Settings::create()); |
There was a problem hiding this comment.
This test belongs in Sabberworm\CSS\Tests\Functional\Value\CSSFunctionTest because it depends on ParserState. Putting it there will involve creating that TestCase class since it does not yet exist.
|
|
||
| $result = CSSFunction::parse($parserState); | ||
|
|
||
| self::assertSame('var(--w,)', $result->render(OutputFormat::createCompact())); |
There was a problem hiding this comment.
This test should only be testing the parsing, not also the rendering. We can do $result->getArrayRepresentation() and make assertions on the returned array representation.
JakeQZ
left a comment
There was a problem hiding this comment.
Looking good now. But I think we need a converse test for CSSFunction. And there's a typo in the changelog entry.
JakeQZ
left a comment
There was a problem hiding this comment.
Super. Thanks again for contributing <3.
oliverklee
left a comment
There was a problem hiding this comment.
Thank you, @samuil-banti-wpenigne! ❤️
var()
CSS allows the default value of var to be empty i.e.
The goal of the PR is to enable us to parse such cases.