Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow lists of nested selectors and allow styles after nested CSS blocks #4040

Merged
merged 7 commits into from
Feb 15, 2024

Conversation

rodrigogiraoserrao
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao commented Jan 17, 2024

Fixes #3969 and fixes #3999.

Changes the tokenizer to accept lists of selectors in a nested context and also to accept styles after nested scopes.

While working on the above, we opened #4039 because the tokenizer isn't yet clever enough to distinguish a selector with a pseudo-class from a rule with a value in a nested context, if the selector + pseudo-class doesn't use the & operator. (See my comment and the interactions under it.)

@rodrigogiraoserrao rodrigogiraoserrao self-assigned this Jan 17, 2024
@rodrigogiraoserrao rodrigogiraoserrao added the bug Something isn't working label Jan 17, 2024
@willmcgugan
Copy link
Collaborator

@rodrigogiraoserrao Please add some detail on what you fixed (and how). The issues you linked to don't make it clear what work is outstanding. The title is also rather vague -- what was improved?

@rodrigogiraoserrao rodrigogiraoserrao changed the title Improve nested tcss Allow lists of nested selectors and allow styles after nested CSS blocks Feb 7, 2024
@rodrigogiraoserrao
Copy link
Contributor Author

@willmcgugan changed the title, expanded the description, and clarified the outstanding issue 4039.

Copy link
Member

@darrenburns darrenburns left a comment

Choose a reason for hiding this comment

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

I've added a couple more comments - sorry! EDIT: Ignore 😆

@rodrigogiraoserrao
Copy link
Contributor Author

@darrenburns ignored! But did you review at all? It doesn't show neither an accepted nor a change requested.

@darrenburns
Copy link
Member

Nope - I requested changes on the wrong PR. I didn't review this one.

@willmcgugan
Copy link
Collaborator

@rodrigogiraoserrao Your tests are essentially snapshot tests. They are as likely to catch any change to the tokenizer, as they are to catch errors.

Suggest we have a test which takes CSS then checks that the expected styles are set on the widget. If that breaks in the future we know that it is a genuine issue, and not just that we have made an inconsequential changed to the tokenizer.

@rodrigogiraoserrao
Copy link
Contributor Author

@rodrigogiraoserrao Your tests are essentially snapshot tests. They are as likely to catch any change to the tokenizer, as they are to catch errors.

Isn't that true of all tokenizer tests?

Suggest we have a test which takes CSS then checks that the expected styles are set on the widget.

Then, doesn't that mean the test can fail for many different reasons that are completely orthogonal to the thing I'm trying to test, which is that the tokenizer knows what to do with these tokens?

@willmcgugan
Copy link
Collaborator

Isn't that true of all tokenizer tests?

Yes, which is why we don't need more.

Then, doesn't that mean the test can fail for many different reasons that are completely orthogonal to the thing I'm trying to test, which is that the tokenizer knows what to do with these tokens?

That's not what we should be testing. We should be testing the CSS that didn't work before, and now does. The output from the tokenizer does not prove that the CSS is processes as expected.

@rodrigogiraoserrao
Copy link
Contributor Author

@willmcgugan got it. See 3c18e47.
This is ready to be reviewed.

Copy link
Collaborator

@willmcgugan willmcgugan left a comment

Choose a reason for hiding this comment

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

Better!

Copy link
Member

@darrenburns darrenburns 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!

@rodrigogiraoserrao rodrigogiraoserrao merged commit ae35fd5 into main Feb 15, 2024
20 checks passed
@rodrigogiraoserrao rodrigogiraoserrao deleted the improve-nested-tcss branch February 15, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants