Skip to content

Commit 43093b4

Browse files
committed
test(style-node-loc): added node types to tests
1 parent fd076a4 commit 43093b4

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

tests/fixtures/parser/style-location-converter/simple-css-output.json

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
[
3+
"root",
34
{
45
"start": {
56
"line": 9,
@@ -16,6 +17,7 @@
1617
]
1718
],
1819
[
20+
"rule",
1921
{
2022
"start": {
2123
"line": 10,
@@ -32,6 +34,7 @@
3234
]
3335
],
3436
[
37+
"decl",
3538
{
3639
"start": {
3740
"line": 11,
@@ -48,6 +51,7 @@
4851
]
4952
],
5053
[
54+
"rule",
5155
{
5256
"start": {
5357
"line": 14,
@@ -64,6 +68,7 @@
6468
]
6569
],
6670
[
71+
"decl",
6772
{
6873
"start": {
6974
"line": 15,

tests/fixtures/parser/style-location-converter/simple-postcss-output.json

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
[
3+
"root",
34
{
45
"start": {
56
"line": 7,
@@ -16,6 +17,7 @@
1617
]
1718
],
1819
[
20+
"rule",
1921
{
2022
"start": {
2123
"line": 8,
@@ -32,6 +34,7 @@
3234
]
3335
],
3436
[
37+
"decl",
3538
{
3639
"start": {
3740
"line": 9,
@@ -48,6 +51,7 @@
4851
]
4952
],
5053
[
54+
"decl",
5155
{
5256
"start": {
5357
"line": 10,

tests/fixtures/parser/style-location-converter/simple-scss-output.json

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[
22
[
3+
"root",
34
{
45
"start": {
56
"line": 7,
@@ -16,6 +17,7 @@
1617
]
1718
],
1819
[
20+
"rule",
1921
{
2022
"start": {
2123
"line": 8,
@@ -32,6 +34,7 @@
3234
]
3335
],
3436
[
37+
"rule",
3538
{
3639
"start": {
3740
"line": 9,
@@ -48,6 +51,7 @@
4851
]
4952
],
5053
[
54+
"comment",
5155
{
5256
"start": {
5357
"line": 10,
@@ -64,6 +68,7 @@
6468
]
6569
],
6670
[
71+
"decl",
6772
{
6873
"start": {
6974
"line": 11,
@@ -80,6 +85,7 @@
8085
]
8186
],
8287
[
88+
"rule",
8389
{
8490
"start": {
8591
"line": 14,
@@ -96,6 +102,7 @@
96102
]
97103
],
98104
[
105+
"decl",
99106
{
100107
"start": {
101108
"line": 15,

tests/src/parser/style-location-coverter.ts

+3
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,19 @@ describe("Check for AST.", () => {
3636
const styleContext = services.getStyleContext();
3737
assert.strictEqual(styleContext.status, "success");
3838
const locations: [
39+
string,
3940
Partial<SourceLocation>,
4041
[number | undefined, number | undefined],
4142
][] = [
4243
[
44+
"root",
4345
services.styleNodeLoc(styleContext.sourceAst),
4446
services.styleNodeRange(styleContext.sourceAst),
4547
],
4648
];
4749
styleContext.sourceAst.walk((node: Node) => {
4850
locations.push([
51+
node.type,
4952
services.styleNodeLoc(node),
5053
services.styleNodeRange(node),
5154
]);

0 commit comments

Comments
 (0)