Skip to content

Commit

Permalink
Add tests for added pseudos and change log entry
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Feb 27, 2022
1 parent 46fe9b0 commit 97d7f3b
Show file tree
Hide file tree
Showing 6 changed files with 795 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
- Bumped `mdn-data` to `2.0.27`
- Added `module` field to `package.json`
- Fixed minor issues in CommonJS version
- Fixed `css-tree/utils` export
- Fixed `css-tree/utils` export (#181)
- Added `css-tree/convertor` export
- Added `css-tree/selector-parser` export (~27kb when bundled)
- Added `css-tree/selector-parser` export (~27kb when bundled, #183)
- Reduced bundle size:
- `css-tree/parser` 50kb -> 41kb
- `css-tree/generator` 46kb -> 23kb
- Renamed `syntaxes` into `types` in `css-tree/definition-syntax-data-patch`
- Added parsing support for `:is()`, `:-moz-any()`, `:-webkit-any()` and `:where()` (#182, #184)

## 2.0.4 (December 17, 2021)

Expand Down
198 changes: 198 additions & 0 deletions fixtures/ast/selector/functional-pseudo/-moz-any.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
{
"basic": {
"source": ":-moz-any(test)",
"ast": {
"type": "PseudoClassSelector",
"name": "-moz-any",
"children": [
{
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "TypeSelector",
"name": "test"
}
]
}
]
}
]
}
},
"negation with selector group": {
"source": ":-moz-any(.a,.b.c)",
"ast": {
"type": "PseudoClassSelector",
"name": "-moz-any",
"children": [
{
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "ClassSelector",
"name": "a"
}
]
},
{
"type": "Selector",
"children": [
{
"type": "ClassSelector",
"name": "b"
},
{
"type": "ClassSelector",
"name": "c"
}
]
}
]
}
]
}
},
"selector group and spaces": {
"source": ":-moz-any( .a , .b )",
"generate": ":-moz-any(.a,.b)",
"ast": {
"type": "PseudoClassSelector",
"name": "-moz-any",
"children": [
{
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "ClassSelector",
"name": "a"
}
]
},
{
"type": "Selector",
"children": [
{
"type": "ClassSelector",
"name": "b"
}
]
}
]
}
]
}
},
"should be case insensitive": {
"source": ":HaS(.a,.b)",
"ast": {
"type": "PseudoClassSelector",
"name": "HaS",
"children": [
{
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "ClassSelector",
"name": "a"
}
]
},
{
"type": "Selector",
"children": [
{
"type": "ClassSelector",
"name": "b"
}
]
}
]
}
]
}
},
"should support relative selectors": {
"source": ":-moz-any(>.a,+.b)",
"ast": {
"type": "PseudoClassSelector",
"name": "-moz-any",
"children": [
{
"type": "SelectorList",
"children": [
{
"type": "Selector",
"children": [
{
"type": "Combinator",
"name": ">"
},
{
"type": "ClassSelector",
"name": "a"
}
]
},
{
"type": "Selector",
"children": [
{
"type": "Combinator",
"name": "+"
},
{
"type": "ClassSelector",
"name": "b"
}
]
}
]
}
]
}
},
"error": [
{
"source": ":-moz-any(.a{)",
"offset": " ^",
"error": "\")\" is expected"
},
{
"source": ":-moz-any(,.b)",
"offset": " ^",
"error": "Selector is expected"
},
{
"source": ":-moz-any(.a,)",
"offset": " ^",
"error": "Selector is expected"
},
{
"source": ":-moz-any(.a,,)",
"offset": " ^",
"error": "Selector is expected"
},
{
"source": ":-moz-any(.a,.b{)",
"offset": " ^",
"error": "\")\" is expected"
},
{
"source": ":-moz-any(var(--test))",
"offset": " ^",
"error": "Selector is expected"
}
]
}

0 comments on commit 97d7f3b

Please sign in to comment.