Handle classes/ids after pseudo-classes

This commit is contained in:
ItsDrike 2025-07-27 18:30:33 +02:00
parent 0545673e61
commit 9f46a6af42
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
4 changed files with 64 additions and 14 deletions

View file

@ -424,6 +424,14 @@ def test_parse_not_with_missing_argument() -> None:
_ = NotPseudoClassSelector.from_pseudo_cls(pseudo)
def test_parse_class_after_pseudo_class() -> None:
tokens = TokenStream([Token(TokenType.PSEUDO_CLASS, ":first-child"), Token(TokenType.CLASS, ".bar")])
sel = parse_tokens(tokens)
assert isinstance(sel, NthChildPseudoClassSelector)
assert isinstance(sel.selector, SimpleSelector)
assert sel.selector.classes == ["bar"]
def test_parse_multiple_combinators() -> None:
# div .parent > .child + .sibling:not(.bar):first-child
tokens = TokenStream(