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

test(css/parser): check we don't have a regression #6666

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/swc_css_parser/tests/fixture/at-rule/media/input.css
Expand Up @@ -149,3 +149,9 @@
@media screen and func(100px) {}
@media(min-width:calc(10px + 10px)) {}
@media (width > calc(220px + 100px)) {}

@m\65 dia {
.color {
color: red;
}
}
148 changes: 147 additions & 1 deletion crates/swc_css_parser/tests/fixture/at-rule/media/output.json
Expand Up @@ -2,7 +2,7 @@
"type": "Stylesheet",
"span": {
"start": 1,
"end": 4769,
"end": 4823,
"ctxt": 0
},
"rules": [
Expand Down Expand Up @@ -16648,6 +16648,152 @@
},
"value": []
}
},
{
"type": "AtRule",
"span": {
"start": 4770,
"end": 4822,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 4771,
"end": 4779,
"ctxt": 0
},
"value": "media",
"raw": "m\\65 dia"
},
"prelude": null,
"block": {
"type": "SimpleBlock",
"span": {
"start": 4780,
"end": 4822,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 4780,
"end": 4781,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "QualifiedRule",
"span": {
"start": 4786,
"end": 4820,
"ctxt": 0
},
"prelude": {
"type": "SelectorList",
"span": {
"start": 4786,
"end": 4792,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 4786,
"end": 4792,
"ctxt": 0
},
"children": [
{
"type": "CompoundSelector",
"span": {
"start": 4786,
"end": 4792,
"ctxt": 0
},
"nestingSelector": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 4786,
"end": 4792,
"ctxt": 0
},
"text": {
"type": "Ident",
"span": {
"start": 4787,
"end": 4792,
"ctxt": 0
},
"value": "color",
"raw": "color"
}
}
]
}
]
}
]
},
"block": {
"type": "SimpleBlock",
"span": {
"start": 4793,
"end": 4820,
"ctxt": 0
},
"name": {
"type": "PreservedToken",
"span": {
"start": 4793,
"end": 4794,
"ctxt": 0
},
"token": "LBrace"
},
"value": [
{
"type": "Declaration",
"span": {
"start": 4803,
"end": 4813,
"ctxt": 0
},
"name": {
"type": "Ident",
"span": {
"start": 4803,
"end": 4808,
"ctxt": 0
},
"value": "color",
"raw": "color"
},
"value": [
{
"type": "Ident",
"span": {
"start": 4810,
"end": 4813,
"ctxt": 0
},
"value": "red",
"raw": "red"
}
],
"important": null
}
]
}
}
]
}
}
]
}
193 changes: 192 additions & 1 deletion crates/swc_css_parser/tests/fixture/at-rule/media/span.swc-stderr
Expand Up @@ -151,7 +151,13 @@
148 | | @media func(100px) {}
149 | | @media screen and func(100px) {}
150 | | @media(min-width:calc(10px + 10px)) {}
151 | `-> @media (width > calc(220px + 100px)) {}
151 | | @media (width > calc(220px + 100px)) {}
152 | |
153 | | @m\65 dia {
154 | | .color {
155 | | color: red;
156 | | }
157 | `-> }
`----

x Rule
Expand Down Expand Up @@ -23168,3 +23174,188 @@
151 | @media (width > calc(220px + 100px)) {}
: ^
`----

x Rule
,-[$DIR/tests/fixture/at-rule/media/input.css:152:1]
152 |
153 | ,-> @m\65 dia {
154 | | .color {
155 | | color: red;
156 | | }
157 | `-> }
`----

x AtRule
,-[$DIR/tests/fixture/at-rule/media/input.css:152:1]
152 |
153 | ,-> @m\65 dia {
154 | | .color {
155 | | color: red;
156 | | }
157 | `-> }
`----

x AtRuleName
,-[$DIR/tests/fixture/at-rule/media/input.css:152:1]
152 |
153 | @m\65 dia {
: ^^^^^^^^
154 | .color {
`----

x Ident
,-[$DIR/tests/fixture/at-rule/media/input.css:152:1]
152 |
153 | @m\65 dia {
: ^^^^^^^^
154 | .color {
`----

x SimpleBlock
,-[$DIR/tests/fixture/at-rule/media/input.css:152:1]
152 |
153 | ,-> @m\65 dia {
154 | | .color {
155 | | color: red;
156 | | }
157 | `-> }
`----

x LBrace
,-[$DIR/tests/fixture/at-rule/media/input.css:152:1]
152 |
153 | @m\65 dia {
: ^
154 | .color {
`----

x ComponentValue
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | ,-> .color {
155 | | color: red;
156 | `-> }
157 | }
`----

x QualifiedRule
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | ,-> .color {
155 | | color: red;
156 | `-> }
157 | }
`----

x SelectorList
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^^^^^^
155 | color: red;
`----

x ComplexSelector
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^^^^^^
155 | color: red;
`----

x CompoundSelector
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^^^^^^
155 | color: red;
`----

x SubclassSelector
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^^^^^^
155 | color: red;
`----

x ClassSelector
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^^^^^^
155 | color: red;
`----

x Ident
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^^^^^
155 | color: red;
`----

x SimpleBlock
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | ,-> .color {
155 | | color: red;
156 | `-> }
157 | }
`----

x LBrace
,-[$DIR/tests/fixture/at-rule/media/input.css:153:1]
153 | @m\65 dia {
154 | .color {
: ^
155 | color: red;
`----

x ComponentValue
,-[$DIR/tests/fixture/at-rule/media/input.css:154:1]
154 | .color {
155 | color: red;
: ^^^^^^^^^^
156 | }
`----

x Declaration
,-[$DIR/tests/fixture/at-rule/media/input.css:154:1]
154 | .color {
155 | color: red;
: ^^^^^^^^^^
156 | }
`----

x DeclarationName
,-[$DIR/tests/fixture/at-rule/media/input.css:154:1]
154 | .color {
155 | color: red;
: ^^^^^
156 | }
`----

x Ident
,-[$DIR/tests/fixture/at-rule/media/input.css:154:1]
154 | .color {
155 | color: red;
: ^^^^^
156 | }
`----

x ComponentValue
,-[$DIR/tests/fixture/at-rule/media/input.css:154:1]
154 | .color {
155 | color: red;
: ^^^
156 | }
`----

x Ident
,-[$DIR/tests/fixture/at-rule/media/input.css:154:1]
154 | .color {
155 | color: red;
: ^^^
156 | }
`----