-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
271 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
{ | ||
"basic": { | ||
"source": ":has(test)", | ||
"ast": { | ||
"type": "PseudoClass", | ||
"name": "has", | ||
"children": [ | ||
{ | ||
"type": "Selector", | ||
"children": [ | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Type", | ||
"name": "test" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"negation with selector group": { | ||
"source": ":has(.a,.b.c)", | ||
"ast": { | ||
"type": "PseudoClass", | ||
"name": "has", | ||
"children": [ | ||
{ | ||
"type": "Selector", | ||
"children": [ | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Class", | ||
"name": "a" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Class", | ||
"name": "b" | ||
}, | ||
{ | ||
"type": "Class", | ||
"name": "c" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"selector group and spaces": { | ||
"source": ":has( .a , .b )", | ||
"translate": ":has(.a,.b)", | ||
"ast": { | ||
"type": "PseudoClass", | ||
"name": "has", | ||
"children": [ | ||
{ | ||
"type": "Selector", | ||
"children": [ | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Class", | ||
"name": "a" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Class", | ||
"name": "b" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"should be case insensitive": { | ||
"source": ":HaS(.a,.b)", | ||
"ast": { | ||
"type": "PseudoClass", | ||
"name": "HaS", | ||
"children": [ | ||
{ | ||
"type": "Selector", | ||
"children": [ | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Class", | ||
"name": "a" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Class", | ||
"name": "b" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"should support relative selectors": { | ||
"source": ":has(> .a,+.b)", | ||
"translate": ":has(>.a,+.b)", | ||
"ast": { | ||
"type": "PseudoClass", | ||
"name": "has", | ||
"children": [ | ||
{ | ||
"type": "Selector", | ||
"children": [ | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Combinator", | ||
"name": ">" | ||
}, | ||
{ | ||
"type": "Class", | ||
"name": "a" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "SimpleSelector", | ||
"children": [ | ||
{ | ||
"type": "Combinator", | ||
"name": "+" | ||
}, | ||
{ | ||
"type": "Class", | ||
"name": "b" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"error #1": { | ||
"source": ":has(.a{)", | ||
"offset": " ^", | ||
"error": "Unexpected input" | ||
}, | ||
"error #2": { | ||
"source": ":has(,.b)", | ||
"offset": " ^", | ||
"error": "Unexpected comma" | ||
}, | ||
"error #3": { | ||
"source": ":has(.a,)", | ||
"offset": " ^", | ||
"error": "Unexpected trailing comma" | ||
}, | ||
"error #4": { | ||
"source": ":has(.a,,)", | ||
"offset": " ^", | ||
"error": "Unexpected comma" | ||
}, | ||
"error #5": { | ||
"source": ":has(.a,.b{)", | ||
"offset": " ^", | ||
"error": "Unexpected input" | ||
}, | ||
"error #6": { | ||
"source": ":has(--test)", | ||
"offset": " ^", | ||
"error": "Identifier is expected" | ||
}, | ||
"error #7": { | ||
"source": ":has(var(--test))", | ||
"offset": " ^", | ||
"error": "Unexpected input" | ||
}, | ||
"error #8": { | ||
"source": ":has(>+a)", | ||
"offset": " ^", | ||
"error": "Unexpected combinator" | ||
}, | ||
"error #9": { | ||
"source": ":has(~foo, >+a)", | ||
"offset": " ^", | ||
"error": "Unexpected combinator" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.