test(css/parser): Add tests for hex colors (#2360)

This commit is contained in:
Alexander Akait 2021-10-07 09:14:11 +03:00 committed by GitHub
parent edc4cb432e
commit 1e9ecfbad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 738 additions and 0 deletions

View File

@ -0,0 +1,13 @@
a {
color: #000000;
color: #ffffff;
color: #FFFFFF;
color: #0000ffcc;
color: #0000FFCC;
color: #000;
color: #fff;
color: #FFF;
color: #0000;
color: #ffff;
color: #FFFF;
}

View File

@ -0,0 +1,388 @@
{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 193,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 192,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"value": "a"
}
},
"subclassSelectors": []
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 2,
"end": 192,
"ctxt": 0
},
"items": [
{
"type": "Property",
"span": {
"start": 6,
"end": 20,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 6,
"end": 11,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 13,
"end": 20,
"ctxt": 0
},
"value": "000000"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 24,
"end": 38,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 24,
"end": 29,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 31,
"end": 38,
"ctxt": 0
},
"value": "ffffff"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 42,
"end": 56,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 42,
"end": 47,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 49,
"end": 56,
"ctxt": 0
},
"value": "FFFFFF"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 60,
"end": 76,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 60,
"end": 65,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 67,
"end": 76,
"ctxt": 0
},
"value": "0000ffcc"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 80,
"end": 96,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 80,
"end": 85,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 87,
"end": 96,
"ctxt": 0
},
"value": "0000FFCC"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 100,
"end": 111,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 100,
"end": 105,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 107,
"end": 111,
"ctxt": 0
},
"value": "000"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 115,
"end": 126,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 115,
"end": 120,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 122,
"end": 126,
"ctxt": 0
},
"value": "fff"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 130,
"end": 141,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 130,
"end": 135,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 137,
"end": 141,
"ctxt": 0
},
"value": "FFF"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 145,
"end": 157,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 145,
"end": 150,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 152,
"end": 157,
"ctxt": 0
},
"value": "0000"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 161,
"end": 173,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 161,
"end": 166,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 168,
"end": 173,
"ctxt": 0
},
"value": "ffff"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 177,
"end": 189,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 177,
"end": 182,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "HashValue",
"span": {
"start": 184,
"end": 189,
"ctxt": 0
},
"value": "FFFF"
}
],
"important": null
}
]
}
}
]
}

View File

@ -0,0 +1,337 @@
error: Stylesheet
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | / a {
2 | | color: #000000;
3 | | color: #ffffff;
4 | | color: #FFFFFF;
... |
12 | | color: #FFFF;
13 | | }
| |__^
error: Rule
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | / a {
2 | | color: #000000;
3 | | color: #ffffff;
4 | | color: #FFFFFF;
... |
12 | | color: #FFFF;
13 | | }
| |_^
error: StyleRule
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | / a {
2 | | color: #000000;
3 | | color: #ffffff;
4 | | color: #FFFFFF;
... |
12 | | color: #FFFF;
13 | | }
| |_^
error: ComplexSelector
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | a {
| ^
error: CompoundSelector
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | a {
| ^
error: NamespacedName
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | a {
| ^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:1:1
|
1 | a {
| ^
error: DeclBlock
--> $DIR/tests/fixture/hex-colors/input.css:1:3
|
1 | a {
| ___^
2 | | color: #000000;
3 | | color: #ffffff;
4 | | color: #FFFFFF;
... |
12 | | color: #FFFF;
13 | | }
| |_^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:2:3
|
2 | color: #000000;
| ^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:2:3
|
2 | color: #000000;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:2:10
|
2 | color: #000000;
| ^^^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:2:10
|
2 | color: #000000;
| ^^^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:3:3
|
3 | color: #ffffff;
| ^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:3:3
|
3 | color: #ffffff;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:3:10
|
3 | color: #ffffff;
| ^^^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:3:10
|
3 | color: #ffffff;
| ^^^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:4:3
|
4 | color: #FFFFFF;
| ^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:4:3
|
4 | color: #FFFFFF;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:4:10
|
4 | color: #FFFFFF;
| ^^^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:4:10
|
4 | color: #FFFFFF;
| ^^^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:5:3
|
5 | color: #0000ffcc;
| ^^^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:5:3
|
5 | color: #0000ffcc;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:5:10
|
5 | color: #0000ffcc;
| ^^^^^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:5:10
|
5 | color: #0000ffcc;
| ^^^^^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:6:3
|
6 | color: #0000FFCC;
| ^^^^^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:6:3
|
6 | color: #0000FFCC;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:6:10
|
6 | color: #0000FFCC;
| ^^^^^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:6:10
|
6 | color: #0000FFCC;
| ^^^^^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:7:3
|
7 | color: #000;
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:7:3
|
7 | color: #000;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:7:10
|
7 | color: #000;
| ^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:7:10
|
7 | color: #000;
| ^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:8:3
|
8 | color: #fff;
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:8:3
|
8 | color: #fff;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:8:10
|
8 | color: #fff;
| ^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:8:10
|
8 | color: #fff;
| ^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:9:3
|
9 | color: #FFF;
| ^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:9:3
|
9 | color: #FFF;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:9:10
|
9 | color: #FFF;
| ^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:9:10
|
9 | color: #FFF;
| ^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:10:3
|
10 | color: #0000;
| ^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:10:3
|
10 | color: #0000;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:10:10
|
10 | color: #0000;
| ^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:10:10
|
10 | color: #0000;
| ^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:11:3
|
11 | color: #ffff;
| ^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:11:3
|
11 | color: #ffff;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:11:10
|
11 | color: #ffff;
| ^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:11:10
|
11 | color: #ffff;
| ^^^^^
error: Property
--> $DIR/tests/fixture/hex-colors/input.css:12:3
|
12 | color: #FFFF;
| ^^^^^^^^^^^^
error: Text
--> $DIR/tests/fixture/hex-colors/input.css:12:3
|
12 | color: #FFFF;
| ^^^^^
error: Value
--> $DIR/tests/fixture/hex-colors/input.css:12:10
|
12 | color: #FFFF;
| ^^^^^
error: HashValue
--> $DIR/tests/fixture/hex-colors/input.css:12:10
|
12 | color: #FFFF;
| ^^^^^