test(css/parser): Add tests for @page at-rule (#2296)

This commit is contained in:
Alexander Akait 2021-09-24 10:12:08 +03:00 committed by GitHub
parent 75c930caf1
commit 2a565e8464
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 976 additions and 0 deletions

View File

@ -0,0 +1,8 @@
@page{ }
@page{}
@page{margin: 1cm}
@page {margin: 1cm}
@page {margin: 1cm;}
@page :first {margin: 2cm}
@page :first {margin: 2cm;}
@page :first{margin: 2cm;}

View File

@ -0,0 +1,476 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 159,
"ctxt": 0
},
"rules": [
{
"type": "PageRule",
"span": {
"start": 0,
"end": 8,
"ctxt": 0
},
"prelude": [],
"block": {
"span": {
"start": 5,
"end": 8,
"ctxt": 0
},
"items": []
}
},
{
"type": "PageRule",
"span": {
"start": 9,
"end": 16,
"ctxt": 0
},
"prelude": [],
"block": {
"span": {
"start": 14,
"end": 16,
"ctxt": 0
},
"items": []
}
},
{
"type": "PageRule",
"span": {
"start": 17,
"end": 35,
"ctxt": 0
},
"prelude": [],
"block": {
"span": {
"start": 22,
"end": 35,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 23,
"end": 34,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 23,
"end": 29,
"ctxt": 0
},
"value": "margin"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 31,
"end": 34,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 31,
"end": 32,
"ctxt": 0
},
"value": 1.0
},
"unit": {
"span": {
"start": 32,
"end": 34,
"ctxt": 0
},
"kind": "cm"
}
}
],
"important": null
}
]
}
},
{
"type": "PageRule",
"span": {
"start": 36,
"end": 55,
"ctxt": 0
},
"prelude": [],
"block": {
"span": {
"start": 42,
"end": 55,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 43,
"end": 54,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 43,
"end": 49,
"ctxt": 0
},
"value": "margin"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 51,
"end": 54,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 51,
"end": 52,
"ctxt": 0
},
"value": 1.0
},
"unit": {
"span": {
"start": 52,
"end": 54,
"ctxt": 0
},
"kind": "cm"
}
}
],
"important": null
}
]
}
},
{
"type": "PageRule",
"span": {
"start": 56,
"end": 76,
"ctxt": 0
},
"prelude": [],
"block": {
"span": {
"start": 62,
"end": 76,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 63,
"end": 74,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 63,
"end": 69,
"ctxt": 0
},
"value": "margin"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 71,
"end": 74,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 71,
"end": 72,
"ctxt": 0
},
"value": 1.0
},
"unit": {
"span": {
"start": 72,
"end": 74,
"ctxt": 0
},
"kind": "cm"
}
}
],
"important": null
}
]
}
},
{
"type": "PageRule",
"span": {
"start": 77,
"end": 103,
"ctxt": 0
},
"prelude": [
{
"span": {
"start": 83,
"end": 89,
"ctxt": 0
},
"ident": null,
"pseudo": {
"type": "Text",
"span": {
"start": 84,
"end": 89,
"ctxt": 0
},
"value": "first"
}
}
],
"block": {
"span": {
"start": 90,
"end": 103,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 91,
"end": 102,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 91,
"end": 97,
"ctxt": 0
},
"value": "margin"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 99,
"end": 102,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 99,
"end": 100,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 100,
"end": 102,
"ctxt": 0
},
"kind": "cm"
}
}
],
"important": null
}
]
}
},
{
"type": "PageRule",
"span": {
"start": 104,
"end": 131,
"ctxt": 0
},
"prelude": [
{
"span": {
"start": 110,
"end": 116,
"ctxt": 0
},
"ident": null,
"pseudo": {
"type": "Text",
"span": {
"start": 111,
"end": 116,
"ctxt": 0
},
"value": "first"
}
}
],
"block": {
"span": {
"start": 117,
"end": 131,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 118,
"end": 129,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 118,
"end": 124,
"ctxt": 0
},
"value": "margin"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 126,
"end": 129,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 126,
"end": 127,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 127,
"end": 129,
"ctxt": 0
},
"kind": "cm"
}
}
],
"important": null
}
]
}
},
{
"type": "PageRule",
"span": {
"start": 132,
"end": 158,
"ctxt": 0
},
"prelude": [
{
"span": {
"start": 138,
"end": 144,
"ctxt": 0
},
"ident": null,
"pseudo": {
"type": "Text",
"span": {
"start": 139,
"end": 144,
"ctxt": 0
},
"value": "first"
}
}
],
"block": {
"span": {
"start": 144,
"end": 158,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 145,
"end": 156,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 145,
"end": 151,
"ctxt": 0
},
"value": "margin"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 153,
"end": 156,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 153,
"end": 154,
"ctxt": 0
},
"value": 2.0
},
"unit": {
"span": {
"start": 154,
"end": 156,
"ctxt": 0
},
"kind": "cm"
}
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,492 @@
error: Stylesheet
--> $DIR/tests/fixture/at-rule/page/input.css:1:1
|
1 | / @page{ }
2 | | @page{}
3 | | @page{margin: 1cm}
4 | | @page {margin: 1cm}
... |
7 | | @page :first {margin: 2cm;}
8 | | @page :first{margin: 2cm;}
| |___________________________^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:1:1
|
1 | @page{ }
| ^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:1:1
|
1 | @page{ }
| ^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:1:1
|
1 | @page{ }
| ^^^^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:1:6
|
1 | @page{ }
| ^^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:2:1
|
2 | @page{}
| ^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:2:1
|
2 | @page{}
| ^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:2:1
|
2 | @page{}
| ^^^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:2:6
|
2 | @page{}
| ^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:3:1
|
3 | @page{margin: 1cm}
| ^^^^^^^^^^^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:3:1
|
3 | @page{margin: 1cm}
| ^^^^^^^^^^^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:3:1
|
3 | @page{margin: 1cm}
| ^^^^^^^^^^^^^^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:3:6
|
3 | @page{margin: 1cm}
| ^^^^^^^^^^^^^
error: PageRuleBlockItem
--> $DIR/tests/fixture/at-rule/page/input.css:3:7
|
3 | @page{margin: 1cm}
| ^^^^^^^^^^^
error: Property
--> $DIR/tests/fixture/at-rule/page/input.css:3:7
|
3 | @page{margin: 1cm}
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:3:7
|
3 | @page{margin: 1cm}
| ^^^^^^
error: Value
--> $DIR/tests/fixture/at-rule/page/input.css:3:15
|
3 | @page{margin: 1cm}
| ^^^
error: UnitValue
--> $DIR/tests/fixture/at-rule/page/input.css:3:15
|
3 | @page{margin: 1cm}
| ^^^
error: Num
--> $DIR/tests/fixture/at-rule/page/input.css:3:15
|
3 | @page{margin: 1cm}
| ^
error: Unit
--> $DIR/tests/fixture/at-rule/page/input.css:3:16
|
3 | @page{margin: 1cm}
| ^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:4:1
|
4 | @page {margin: 1cm}
| ^^^^^^^^^^^^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:4:1
|
4 | @page {margin: 1cm}
| ^^^^^^^^^^^^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:4:1
|
4 | @page {margin: 1cm}
| ^^^^^^^^^^^^^^^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:4:7
|
4 | @page {margin: 1cm}
| ^^^^^^^^^^^^^
error: PageRuleBlockItem
--> $DIR/tests/fixture/at-rule/page/input.css:4:8
|
4 | @page {margin: 1cm}
| ^^^^^^^^^^^
error: Property
--> $DIR/tests/fixture/at-rule/page/input.css:4:8
|
4 | @page {margin: 1cm}
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:4:8
|
4 | @page {margin: 1cm}
| ^^^^^^
error: Value
--> $DIR/tests/fixture/at-rule/page/input.css:4:16
|
4 | @page {margin: 1cm}
| ^^^
error: UnitValue
--> $DIR/tests/fixture/at-rule/page/input.css:4:16
|
4 | @page {margin: 1cm}
| ^^^
error: Num
--> $DIR/tests/fixture/at-rule/page/input.css:4:16
|
4 | @page {margin: 1cm}
| ^
error: Unit
--> $DIR/tests/fixture/at-rule/page/input.css:4:17
|
4 | @page {margin: 1cm}
| ^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:5:1
|
5 | @page {margin: 1cm;}
| ^^^^^^^^^^^^^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:5:1
|
5 | @page {margin: 1cm;}
| ^^^^^^^^^^^^^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:5:1
|
5 | @page {margin: 1cm;}
| ^^^^^^^^^^^^^^^^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:5:7
|
5 | @page {margin: 1cm;}
| ^^^^^^^^^^^^^^
error: PageRuleBlockItem
--> $DIR/tests/fixture/at-rule/page/input.css:5:8
|
5 | @page {margin: 1cm;}
| ^^^^^^^^^^^
error: Property
--> $DIR/tests/fixture/at-rule/page/input.css:5:8
|
5 | @page {margin: 1cm;}
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:5:8
|
5 | @page {margin: 1cm;}
| ^^^^^^
error: Value
--> $DIR/tests/fixture/at-rule/page/input.css:5:16
|
5 | @page {margin: 1cm;}
| ^^^
error: UnitValue
--> $DIR/tests/fixture/at-rule/page/input.css:5:16
|
5 | @page {margin: 1cm;}
| ^^^
error: Num
--> $DIR/tests/fixture/at-rule/page/input.css:5:16
|
5 | @page {margin: 1cm;}
| ^
error: Unit
--> $DIR/tests/fixture/at-rule/page/input.css:5:17
|
5 | @page {margin: 1cm;}
| ^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:6:1
|
6 | @page :first {margin: 2cm}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:6:1
|
6 | @page :first {margin: 2cm}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:6:1
|
6 | @page :first {margin: 2cm}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: PageSelector
--> $DIR/tests/fixture/at-rule/page/input.css:6:7
|
6 | @page :first {margin: 2cm}
| ^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:6:8
|
6 | @page :first {margin: 2cm}
| ^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:6:14
|
6 | @page :first {margin: 2cm}
| ^^^^^^^^^^^^^
error: PageRuleBlockItem
--> $DIR/tests/fixture/at-rule/page/input.css:6:15
|
6 | @page :first {margin: 2cm}
| ^^^^^^^^^^^
error: Property
--> $DIR/tests/fixture/at-rule/page/input.css:6:15
|
6 | @page :first {margin: 2cm}
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:6:15
|
6 | @page :first {margin: 2cm}
| ^^^^^^
error: Value
--> $DIR/tests/fixture/at-rule/page/input.css:6:23
|
6 | @page :first {margin: 2cm}
| ^^^
error: UnitValue
--> $DIR/tests/fixture/at-rule/page/input.css:6:23
|
6 | @page :first {margin: 2cm}
| ^^^
error: Num
--> $DIR/tests/fixture/at-rule/page/input.css:6:23
|
6 | @page :first {margin: 2cm}
| ^
error: Unit
--> $DIR/tests/fixture/at-rule/page/input.css:6:24
|
6 | @page :first {margin: 2cm}
| ^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:7:1
|
7 | @page :first {margin: 2cm;}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:7:1
|
7 | @page :first {margin: 2cm;}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:7:1
|
7 | @page :first {margin: 2cm;}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: PageSelector
--> $DIR/tests/fixture/at-rule/page/input.css:7:7
|
7 | @page :first {margin: 2cm;}
| ^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:7:8
|
7 | @page :first {margin: 2cm;}
| ^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:7:14
|
7 | @page :first {margin: 2cm;}
| ^^^^^^^^^^^^^^
error: PageRuleBlockItem
--> $DIR/tests/fixture/at-rule/page/input.css:7:15
|
7 | @page :first {margin: 2cm;}
| ^^^^^^^^^^^
error: Property
--> $DIR/tests/fixture/at-rule/page/input.css:7:15
|
7 | @page :first {margin: 2cm;}
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:7:15
|
7 | @page :first {margin: 2cm;}
| ^^^^^^
error: Value
--> $DIR/tests/fixture/at-rule/page/input.css:7:23
|
7 | @page :first {margin: 2cm;}
| ^^^
error: UnitValue
--> $DIR/tests/fixture/at-rule/page/input.css:7:23
|
7 | @page :first {margin: 2cm;}
| ^^^
error: Num
--> $DIR/tests/fixture/at-rule/page/input.css:7:23
|
7 | @page :first {margin: 2cm;}
| ^
error: Unit
--> $DIR/tests/fixture/at-rule/page/input.css:7:24
|
7 | @page :first {margin: 2cm;}
| ^^
error: Rule
--> $DIR/tests/fixture/at-rule/page/input.css:8:1
|
8 | @page :first{margin: 2cm;}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: AtRule
--> $DIR/tests/fixture/at-rule/page/input.css:8:1
|
8 | @page :first{margin: 2cm;}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: PageRule
--> $DIR/tests/fixture/at-rule/page/input.css:8:1
|
8 | @page :first{margin: 2cm;}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: PageSelector
--> $DIR/tests/fixture/at-rule/page/input.css:8:7
|
8 | @page :first{margin: 2cm;}
| ^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:8:8
|
8 | @page :first{margin: 2cm;}
| ^^^^^
error: PageRuleBlock
--> $DIR/tests/fixture/at-rule/page/input.css:8:13
|
8 | @page :first{margin: 2cm;}
| ^^^^^^^^^^^^^^
error: PageRuleBlockItem
--> $DIR/tests/fixture/at-rule/page/input.css:8:14
|
8 | @page :first{margin: 2cm;}
| ^^^^^^^^^^^
error: Property
--> $DIR/tests/fixture/at-rule/page/input.css:8:14
|
8 | @page :first{margin: 2cm;}
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/at-rule/page/input.css:8:14
|
8 | @page :first{margin: 2cm;}
| ^^^^^^
error: Value
--> $DIR/tests/fixture/at-rule/page/input.css:8:22
|
8 | @page :first{margin: 2cm;}
| ^^^
error: UnitValue
--> $DIR/tests/fixture/at-rule/page/input.css:8:22
|
8 | @page :first{margin: 2cm;}
| ^^^
error: Num
--> $DIR/tests/fixture/at-rule/page/input.css:8:22
|
8 | @page :first{margin: 2cm;}
| ^
error: Unit
--> $DIR/tests/fixture/at-rule/page/input.css:8:23
|
8 | @page :first{margin: 2cm;}
| ^^