diff --git a/README.md b/README.md
index efba46c5..a8c68a95 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@ This ESLint plugin provides linting rules relate to better ways to help you avoi
- Provides linting rules for Scoped CSS.
- Supports CSS syntax including level 4 selectors.
- Supports `"
+
+ for (const key of Object.keys(plugin.rules)) {
+ const ruleId = `vue-scoped-css/${key}`
+
+ it(ruleId, () => {
+ const linter = new Linter()
+ const config = {
+ parser: "babel-eslint",
+ parserOptions: { ecmaVersion: 2015 },
+ rules: {
+ [ruleId]: "error",
+ },
+ }
+ linter.defineParser("babel-eslint", parser)
+ linter.defineRule(ruleId, plugin.rules[key] as any)
+ linter.verifyAndFix(code, config as any, "test.vue")
+ })
+ }
+})
diff --git a/tests/lib/rules/no-unused-keyframes.ts b/tests/lib/rules/no-unused-keyframes.ts
index f7f09beb..3c9413f7 100644
--- a/tests/lib/rules/no-unused-keyframes.ts
+++ b/tests/lib/rules/no-unused-keyframes.ts
@@ -52,6 +52,25 @@ tester.run("no-unused-keyframes", rule, {
`,
`
+
+ `,
+ `
+
+ `,
+ `
+
+
+ `,
+ `
+
+ `,
+ errors: [
+ {
+ messageId: "unused",
+ data: { params: "fadein" },
+ line: 7,
+ column: 24,
+ endLine: 7,
+ endColumn: 30,
+ },
+ ],
+ },
],
})
diff --git a/tests/lib/rules/no-unused-selector.ts b/tests/lib/rules/no-unused-selector.ts
index fd09af90..76381ee1 100644
--- a/tests/lib/rules/no-unused-selector.ts
+++ b/tests/lib/rules/no-unused-selector.ts
@@ -16,8 +16,28 @@ tester.run("no-unused-selector", rule, {
+ `,
+ `
+
+
+
+
+ `,
+ `
+
+
+
+
`,
`
@@ -251,6 +271,66 @@ tester.run("no-unused-selector", rule, {
},
],
},
+ {
+ code: `
+
+
+
+
+ `,
+ errors: [
+ {
+ messageId: "unused",
+ data: { selector: ".foo" },
+ line: 6,
+ column: 13,
+ endLine: 6,
+ endColumn: 17,
+ },
+ {
+ messageId: "unused",
+ data: { selector: "div" },
+ line: 7,
+ column: 13,
+ endLine: 7,
+ endColumn: 16,
+ },
+ ],
+ },
+ {
+ code: `
+
+
+
+
+ `,
+ errors: [
+ {
+ messageId: "unused",
+ data: { selector: ".foo" },
+ line: 6,
+ column: 13,
+ endLine: 6,
+ endColumn: 17,
+ },
+ {
+ messageId: "unused",
+ data: { selector: "div" },
+ line: 8,
+ column: 13,
+ endLine: 8,
+ endColumn: 16,
+ },
+ ],
+ },
{
code: `
diff --git a/tests/lib/styles/fixtures/index/@nest-concat01/ast.json b/tests/lib/styles/fixtures/index/@nest-concat01/ast.json
index 9a99e75b..e84a95d4 100644
--- a/tests/lib/styles/fixtures/index/@nest-concat01/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest-concat01/ast.json
@@ -101,6 +101,7 @@
76
],
"name": "nest",
+ "identifier": "@",
"paramsText": "&-bar",
"rawParamsText": "&-bar",
"selectors": [
@@ -189,6 +190,7 @@
97
],
"name": "nest",
+ "identifier": "@",
"paramsText": "&.bar",
"rawParamsText": "&.bar",
"selectors": [
@@ -277,6 +279,7 @@
118
],
"name": "nest",
+ "identifier": "@",
"paramsText": "bar",
"rawParamsText": "bar",
"selectors": [
@@ -365,6 +368,7 @@
138
],
"name": "nest",
+ "identifier": "@",
"paramsText": "&bar",
"rawParamsText": "&bar",
"selectors": [
@@ -453,6 +457,7 @@
160
],
"name": "nest",
+ "identifier": "@",
"paramsText": "&__bar",
"rawParamsText": "&__bar",
"selectors": [
@@ -608,6 +613,7 @@
189
],
"name": "nest",
+ "identifier": "@",
"paramsText": "&-bar",
"rawParamsText": "&-bar",
"selectors": [
@@ -763,6 +769,7 @@
218
],
"name": "nest",
+ "identifier": "@",
"paramsText": "&-bar",
"rawParamsText": "&-bar",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest-concat02/ast.json b/tests/lib/styles/fixtures/index/@nest-concat02/ast.json
index ddf11749..c1fc5955 100644
--- a/tests/lib/styles/fixtures/index/@nest-concat02/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest-concat02/ast.json
@@ -101,6 +101,7 @@
76
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&",
"rawParamsText": ".bar&",
"selectors": [
@@ -256,6 +257,7 @@
106
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&",
"rawParamsText": ".bar&",
"selectors": [
@@ -411,6 +413,7 @@
136
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&",
"rawParamsText": ".bar&",
"selectors": [
@@ -566,6 +569,7 @@
165
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&",
"rawParamsText": ".bar&",
"selectors": [
@@ -721,6 +725,7 @@
196
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&",
"rawParamsText": ".bar&",
"selectors": [
@@ -876,6 +881,7 @@
226
],
"name": "nest",
+ "identifier": "@",
"paramsText": "#bar&",
"rawParamsText": "#bar&",
"selectors": [
@@ -1031,6 +1037,7 @@
256
],
"name": "nest",
+ "identifier": "@",
"paramsText": ":bar&",
"rawParamsText": ":bar&",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest-concat03/ast.json b/tests/lib/styles/fixtures/index/@nest-concat03/ast.json
index 0fa7c438..226df3b4 100644
--- a/tests/lib/styles/fixtures/index/@nest-concat03/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest-concat03/ast.json
@@ -101,6 +101,7 @@
80
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&-baz",
"rawParamsText": ".bar&-baz",
"selectors": [
@@ -277,6 +278,7 @@
114
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&.baz",
"rawParamsText": ".bar&.baz",
"selectors": [
@@ -453,6 +455,7 @@
148
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&:baz",
"rawParamsText": ".bar&:baz",
"selectors": [
@@ -629,6 +632,7 @@
180
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&baz",
"rawParamsText": ".bar&baz",
"selectors": [
@@ -805,6 +809,7 @@
216
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&--baz",
"rawParamsText": ".bar&--baz",
"selectors": [
@@ -981,6 +986,7 @@
250
],
"name": "nest",
+ "identifier": "@",
"paramsText": "#bar&-baz",
"rawParamsText": "#bar&-baz",
"selectors": [
@@ -1157,6 +1163,7 @@
284
],
"name": "nest",
+ "identifier": "@",
"paramsText": ":bar&-baz",
"rawParamsText": ":bar&-baz",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest-concat04/ast.json b/tests/lib/styles/fixtures/index/@nest-concat04/ast.json
index d9eb9313..d1be54e0 100644
--- a/tests/lib/styles/fixtures/index/@nest-concat04/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest-concat04/ast.json
@@ -101,6 +101,7 @@
80
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&-baz",
"rawParamsText": ".bar&-baz",
"selectors": [
@@ -210,6 +211,7 @@
105
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar&>-baz",
"rawParamsText": ".bar&>-baz",
"selectors": [
@@ -340,6 +342,7 @@
131
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar>&>-baz",
"rawParamsText": ".bar>&>-baz",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest-deep01/ast.json b/tests/lib/styles/fixtures/index/@nest-deep01/ast.json
index fa43eeb1..309d6abe 100644
--- a/tests/lib/styles/fixtures/index/@nest-deep01/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest-deep01/ast.json
@@ -143,6 +143,7 @@
104
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar:not(&), :not(& .bar)",
"rawParamsText": ".bar:not(&), :not(& .bar)",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest-invalid01/ast.json b/tests/lib/styles/fixtures/index/@nest-invalid01/ast.json
index dc6d69b8..6d94a712 100644
--- a/tests/lib/styles/fixtures/index/@nest-invalid01/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest-invalid01/ast.json
@@ -36,6 +36,7 @@
71
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".foo > .bar",
"rawParamsText": ".foo > .bar",
"selectors": [
@@ -210,6 +211,7 @@
98
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".bar",
"rawParamsText": ".bar",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest01/ast.json b/tests/lib/styles/fixtures/index/@nest01/ast.json
index 4fa26079..55c963a1 100644
--- a/tests/lib/styles/fixtures/index/@nest01/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest01/ast.json
@@ -101,6 +101,7 @@
79
],
"name": "nest",
+ "identifier": "@",
"paramsText": "& > .bar",
"rawParamsText": "& > .bar",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest02/ast.json b/tests/lib/styles/fixtures/index/@nest02/ast.json
index 76b622ed..bf27ea9d 100644
--- a/tests/lib/styles/fixtures/index/@nest02/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest02/ast.json
@@ -101,6 +101,7 @@
109
],
"name": "nest",
+ "identifier": "@",
"paramsText": "& > .bar",
"rawParamsText": "& /*3*/ > /*4*/ .bar",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/@nest03/ast.json b/tests/lib/styles/fixtures/index/@nest03/ast.json
index 322fad57..1cdc0561 100644
--- a/tests/lib/styles/fixtures/index/@nest03/ast.json
+++ b/tests/lib/styles/fixtures/index/@nest03/ast.json
@@ -143,6 +143,7 @@
87
],
"name": "nest",
+ "identifier": "@",
"paramsText": "& > .bar",
"rawParamsText": "& > .bar",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/keyframes/ast.json b/tests/lib/styles/fixtures/index/keyframes/ast.json
index 452ab6ca..b2e8ede6 100644
--- a/tests/lib/styles/fixtures/index/keyframes/ast.json
+++ b/tests/lib/styles/fixtures/index/keyframes/ast.json
@@ -36,6 +36,7 @@
100
],
"name": "keyframes",
+ "identifier": "@",
"paramsText": "ani",
"rawParamsText": "ani",
"nodes": [
diff --git a/tests/lib/styles/fixtures/index/scss-comment01/ast.json b/tests/lib/styles/fixtures/index/scss-comment01/ast.json
index fa2ead54..a847a6e9 100644
--- a/tests/lib/styles/fixtures/index/scss-comment01/ast.json
+++ b/tests/lib/styles/fixtures/index/scss-comment01/ast.json
@@ -166,6 +166,7 @@
157
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".baz",
"rawParamsText": ".baz",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/scss-comment02/ast.json b/tests/lib/styles/fixtures/index/scss-comment02/ast.json
index b22d15d9..9c35f897 100644
--- a/tests/lib/styles/fixtures/index/scss-comment02/ast.json
+++ b/tests/lib/styles/fixtures/index/scss-comment02/ast.json
@@ -166,6 +166,7 @@
177
],
"name": "nest",
+ "identifier": "@",
"paramsText": ".baz",
"rawParamsText": ".baz",
"selectors": [
diff --git a/tests/lib/styles/fixtures/index/scss-comment03-in-selector/ast.json b/tests/lib/styles/fixtures/index/scss-comment03-in-selector/ast.json
index d53417cc..b3a8563c 100644
--- a/tests/lib/styles/fixtures/index/scss-comment03-in-selector/ast.json
+++ b/tests/lib/styles/fixtures/index/scss-comment03-in-selector/ast.json
@@ -177,15 +177,15 @@
"column": 5
},
"end": {
- "line": 6,
- "column": 0
+ "line": 5,
+ "column": 9
}
},
"start": 67,
- "end": 72,
+ "end": 71,
"range": [
67,
- 72
+ 71
],
"text": " 1"
},
@@ -197,15 +197,15 @@
"column": 6
},
"end": {
- "line": 7,
- "column": 0
+ "line": 6,
+ "column": 10
}
},
"start": 78,
- "end": 83,
+ "end": 82,
"range": [
78,
- 83
+ 82
],
"text": " 2"
}
diff --git a/tests/lib/styles/fixtures/index/scss-comment04-in-selector/ast.json b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/ast.json
new file mode 100644
index 00000000..1c368e61
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/ast.json
@@ -0,0 +1,214 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 26
+ },
+ "end": {
+ "line": 9,
+ "column": 0
+ }
+ },
+ "start": 61,
+ "end": 93,
+ "range": [
+ 61,
+ 93
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "start": 62,
+ "end": 92,
+ "range": [
+ 62,
+ 92
+ ],
+ "selectorText": ".foo \n.bar, \n.baz",
+ "rawSelectorText": ".foo /*1*/\n.bar, /*2*/\n.baz",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 62,
+ "end": 77,
+ "range": [
+ 62,
+ 77
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 62,
+ "end": 66,
+ "range": [
+ 62,
+ 66
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "start": 66,
+ "end": 67,
+ "range": [
+ 66,
+ 67
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 73,
+ "end": 77,
+ "range": [
+ 73,
+ 77
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 85,
+ "end": 89,
+ "range": [
+ 85,
+ 89
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 85,
+ "end": 89,
+ "range": [
+ 85,
+ 89
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+ }
+ ],
+ "nodes": []
+ }
+ ],
+ "comments": [
+ {
+ "type": "VCSSComment",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 5
+ },
+ "end": {
+ "line": 5,
+ "column": 10
+ }
+ },
+ "start": 67,
+ "end": 72,
+ "range": [
+ 67,
+ 72
+ ],
+ "text": "1"
+ },
+ {
+ "type": "VCSSComment",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "start": 79,
+ "end": 84,
+ "range": [
+ 79,
+ 84
+ ],
+ "text": "2"
+ }
+ ],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/scss-comment04-in-selector/selectors-text.json b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/selectors-text.json
new file mode 100644
index 00000000..8aaed363
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/selectors-text.json
@@ -0,0 +1,10 @@
+[
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ],
+ [
+ ".baz"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/scss-comment04-in-selector/selectors.json b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/selectors.json
new file mode 100644
index 00000000..8ec02adc
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/selectors.json
@@ -0,0 +1,90 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 62,
+ "end": 66,
+ "range": [
+ 62,
+ 66
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "start": 66,
+ "end": 67,
+ "range": [
+ 66,
+ 67
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 73,
+ "end": 77,
+ "range": [
+ 73,
+ 77
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 85,
+ "end": 89,
+ "range": [
+ 85,
+ 89
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/scss-comment04-in-selector/source.vue b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/source.vue
new file mode 100644
index 00000000..c55c0ac7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/scss-comment04-in-selector/source.vue
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/scss-interpolation01-selector/ast.json b/tests/lib/styles/fixtures/index/scss-interpolation01-selector/ast.json
index e439a2d6..40bb0112 100644
--- a/tests/lib/styles/fixtures/index/scss-interpolation01-selector/ast.json
+++ b/tests/lib/styles/fixtures/index/scss-interpolation01-selector/ast.json
@@ -11,10 +11,10 @@
}
},
"start": 61,
- "end": 412,
+ "end": 426,
"range": [
61,
- 412
+ 426
],
"nodes": [
{
@@ -206,13 +206,13 @@
}
},
"start": 178,
- "end": 342,
+ "end": 356,
"range": [
178,
- 342
+ 356
],
- "selectorText": "tag#{$tag}\n##{$id}\n.#{$class}class[#{$attr}]\n[attr=#{$attr-val}]\n::pseudo#{$pseudo}\n:pseudo2#{$pseudo}\n::fn( .#{$in-pseudo} )\n/#{$named-comb}/",
- "rawSelectorText": "tag#{$tag}\n##{$id}\n.#{$class}class[#{$attr}]\n[attr=#{$attr-val}]\n::pseudo#{$pseudo}\n:pseudo2#{$pseudo}\n::fn( .#{$in-pseudo} )\n/#{$named-comb}/",
+ "selectorText": "tag#{$tag}\n##{$id}\n.#{$class}class[#{$attr}]\n[attr=#{$attr-val}] \n::pseudo#{$pseudo}\n:pseudo2#{$pseudo}\n::fn( .#{$in-pseudo} )\n/#{$named-comb}/",
+ "rawSelectorText": "tag#{$tag}\n##{$id}\n.#{$class}class[#{$attr}]\n[attr=#{$attr-val}] // #{comment}\n::pseudo#{$pseudo}\n:pseudo2#{$pseudo}\n::fn( .#{$in-pseudo} )\n/#{$named-comb}/",
"selectors": [
{
"type": "VCSSSelector",
@@ -227,10 +227,10 @@
}
},
"start": 178,
- "end": 320,
+ "end": 334,
"range": [
178,
- 320
+ 334
],
"nodes": [
{
@@ -417,8 +417,8 @@
"column": 19
},
"end": {
- "line": 16,
- "column": 0
+ "line": 15,
+ "column": 20
}
},
"start": 242,
@@ -442,11 +442,11 @@
"column": 18
}
},
- "start": 243,
- "end": 261,
+ "start": 257,
+ "end": 275,
"range": [
- 243,
- 261
+ 257,
+ 275
],
"value": "::pseudo#{$pseudo}",
"nodes": []
@@ -463,11 +463,11 @@
"column": 0
}
},
- "start": 261,
- "end": 262,
+ "start": 275,
+ "end": 276,
"range": [
- 261,
- 262
+ 275,
+ 276
],
"value": " ",
"selector": " "
@@ -484,11 +484,11 @@
"column": 18
}
},
- "start": 262,
- "end": 280,
+ "start": 276,
+ "end": 294,
"range": [
- 262,
- 280
+ 276,
+ 294
],
"value": ":pseudo2#{$pseudo}",
"nodes": []
@@ -505,11 +505,11 @@
"column": 0
}
},
- "start": 280,
- "end": 281,
+ "start": 294,
+ "end": 295,
"range": [
- 280,
- 281
+ 294,
+ 295
],
"value": " ",
"selector": " "
@@ -526,11 +526,11 @@
"column": 22
}
},
- "start": 281,
- "end": 303,
+ "start": 295,
+ "end": 317,
"range": [
- 281,
- 303
+ 295,
+ 317
],
"value": "::fn",
"nodes": [
@@ -546,11 +546,11 @@
"column": 20
}
},
- "start": 287,
- "end": 301,
+ "start": 301,
+ "end": 315,
"range": [
- 287,
- 301
+ 301,
+ 315
],
"nodes": [
{
@@ -565,11 +565,11 @@
"column": 20
}
},
- "start": 287,
- "end": 301,
+ "start": 301,
+ "end": 315,
"range": [
- 287,
- 301
+ 301,
+ 315
],
"value": "#{$in-pseudo}",
"selector": ".#{$in-pseudo}"
@@ -590,11 +590,11 @@
"column": 16
}
},
- "start": 304,
- "end": 320,
+ "start": 318,
+ "end": 334,
"range": [
- 304,
- 320
+ 318,
+ 334
],
"value": "/#{$named-comb}/",
"selector": "/#{$named-comb}/"
@@ -616,11 +616,11 @@
"column": 1
}
},
- "start": 344,
- "end": 357,
+ "start": 358,
+ "end": 371,
"range": [
- 344,
- 357
+ 358,
+ 371
],
"selectorText": "\"#{$wow}\"",
"rawSelectorText": "\"#{$wow}\"",
@@ -637,11 +637,11 @@
"column": 9
}
},
- "start": 344,
- "end": 353,
+ "start": 358,
+ "end": 367,
"range": [
- 344,
- 353
+ 358,
+ 367
],
"nodes": [
{
@@ -656,11 +656,11 @@
"column": 9
}
},
- "start": 344,
- "end": 353,
+ "start": 358,
+ "end": 367,
"range": [
- 344,
- 353
+ 358,
+ 367
],
"value": "\"#{$wow}\"",
"selector": "\"#{$wow}\""
@@ -682,11 +682,11 @@
"column": 1
}
},
- "start": 359,
- "end": 379,
+ "start": 373,
+ "end": 393,
"range": [
- 359,
- 379
+ 373,
+ 393
],
"selectorText": ".class \"#{$wow}\"",
"rawSelectorText": ".class \"#{$wow}\"",
@@ -703,11 +703,11 @@
"column": 16
}
},
- "start": 359,
- "end": 375,
+ "start": 373,
+ "end": 389,
"range": [
- 359,
- 375
+ 373,
+ 389
],
"nodes": [
{
@@ -722,11 +722,11 @@
"column": 6
}
},
- "start": 359,
- "end": 365,
+ "start": 373,
+ "end": 379,
"range": [
- 359,
- 365
+ 373,
+ 379
],
"value": "class",
"selector": ".class"
@@ -743,11 +743,11 @@
"column": 7
}
},
- "start": 365,
- "end": 366,
+ "start": 379,
+ "end": 380,
"range": [
- 365,
- 366
+ 379,
+ 380
],
"value": " ",
"selector": " "
@@ -764,11 +764,11 @@
"column": 16
}
},
- "start": 366,
- "end": 375,
+ "start": 380,
+ "end": 389,
"range": [
- 366,
- 375
+ 380,
+ 389
],
"value": "\"#{$wow}\"",
"selector": "\"#{$wow}\""
@@ -790,11 +790,11 @@
"column": 1
}
},
- "start": 382,
- "end": 411,
+ "start": 396,
+ "end": 425,
"range": [
- 382,
- 411
+ 396,
+ 425
],
"selectorText": ".emoji-#{\n \n $name\n \n}",
"rawSelectorText": ".emoji-#{\n \n $name\n \n}",
@@ -811,11 +811,11 @@
"column": 1
}
},
- "start": 382,
- "end": 407,
+ "start": 396,
+ "end": 421,
"range": [
- 382,
- 407
+ 396,
+ 421
],
"nodes": [
{
@@ -830,11 +830,11 @@
"column": 1
}
},
- "start": 382,
- "end": 407,
+ "start": 396,
+ "end": 421,
"range": [
- 382,
- 407
+ 396,
+ 421
],
"value": "emoji-#{\n \n $name\n \n}",
"selector": ".emoji-#{\n \n $name\n \n}"
@@ -846,6 +846,26 @@
}
],
"comments": [
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 15,
+ "column": 20
+ },
+ "end": {
+ "line": 15,
+ "column": 33
+ }
+ },
+ "start": 243,
+ "end": 256,
+ "range": [
+ 243,
+ 256
+ ],
+ "text": " #{comment}"
+ },
{
"type": "VCSSComment",
"loc": {
@@ -858,11 +878,11 @@
"column": 34
}
},
- "start": 321,
- "end": 338,
+ "start": 335,
+ "end": 352,
"range": [
- 321,
- 338
+ 335,
+ 352
],
"text": "#{$comment}"
}
diff --git a/tests/lib/styles/fixtures/index/scss-interpolation01-selector/selectors.json b/tests/lib/styles/fixtures/index/scss-interpolation01-selector/selectors.json
index 6106fe8d..fd56669a 100644
--- a/tests/lib/styles/fixtures/index/scss-interpolation01-selector/selectors.json
+++ b/tests/lib/styles/fixtures/index/scss-interpolation01-selector/selectors.json
@@ -228,8 +228,8 @@
"column": 19
},
"end": {
- "line": 16,
- "column": 0
+ "line": 15,
+ "column": 20
}
},
"start": 242,
@@ -253,11 +253,11 @@
"column": 18
}
},
- "start": 243,
- "end": 261,
+ "start": 257,
+ "end": 275,
"range": [
- 243,
- 261
+ 257,
+ 275
],
"value": "::pseudo#{$pseudo}",
"nodes": []
@@ -274,11 +274,11 @@
"column": 0
}
},
- "start": 261,
- "end": 262,
+ "start": 275,
+ "end": 276,
"range": [
- 261,
- 262
+ 275,
+ 276
],
"value": " ",
"selector": " "
@@ -295,11 +295,11 @@
"column": 18
}
},
- "start": 262,
- "end": 280,
+ "start": 276,
+ "end": 294,
"range": [
- 262,
- 280
+ 276,
+ 294
],
"value": ":pseudo2#{$pseudo}",
"nodes": []
@@ -316,11 +316,11 @@
"column": 0
}
},
- "start": 280,
- "end": 281,
+ "start": 294,
+ "end": 295,
"range": [
- 280,
- 281
+ 294,
+ 295
],
"value": " ",
"selector": " "
@@ -337,11 +337,11 @@
"column": 22
}
},
- "start": 281,
- "end": 303,
+ "start": 295,
+ "end": 317,
"range": [
- 281,
- 303
+ 295,
+ 317
],
"value": "::fn",
"nodes": [
@@ -357,11 +357,11 @@
"column": 20
}
},
- "start": 287,
- "end": 301,
+ "start": 301,
+ "end": 315,
"range": [
- 287,
- 301
+ 301,
+ 315
],
"nodes": [
{
@@ -376,11 +376,11 @@
"column": 20
}
},
- "start": 287,
- "end": 301,
+ "start": 301,
+ "end": 315,
"range": [
- 287,
- 301
+ 301,
+ 315
],
"value": "#{$in-pseudo}",
"selector": ".#{$in-pseudo}"
@@ -401,11 +401,11 @@
"column": 16
}
},
- "start": 304,
- "end": 320,
+ "start": 318,
+ "end": 334,
"range": [
- 304,
- 320
+ 318,
+ 334
],
"value": "/#{$named-comb}/",
"selector": "/#{$named-comb}/"
@@ -424,11 +424,11 @@
"column": 9
}
},
- "start": 344,
- "end": 353,
+ "start": 358,
+ "end": 367,
"range": [
- 344,
- 353
+ 358,
+ 367
],
"value": "\"#{$wow}\"",
"selector": "\"#{$wow}\""
@@ -447,11 +447,11 @@
"column": 6
}
},
- "start": 359,
- "end": 365,
+ "start": 373,
+ "end": 379,
"range": [
- 359,
- 365
+ 373,
+ 379
],
"value": "class",
"selector": ".class"
@@ -468,11 +468,11 @@
"column": 7
}
},
- "start": 365,
- "end": 366,
+ "start": 379,
+ "end": 380,
"range": [
- 365,
- 366
+ 379,
+ 380
],
"value": " ",
"selector": " "
@@ -489,11 +489,11 @@
"column": 16
}
},
- "start": 366,
- "end": 375,
+ "start": 380,
+ "end": 389,
"range": [
- 366,
- 375
+ 380,
+ 389
],
"value": "\"#{$wow}\"",
"selector": "\"#{$wow}\""
@@ -512,11 +512,11 @@
"column": 1
}
},
- "start": 382,
- "end": 407,
+ "start": 396,
+ "end": 421,
"range": [
- 382,
- 407
+ 396,
+ 421
],
"value": "emoji-#{\n \n $name\n \n}",
"selector": ".emoji-#{\n \n $name\n \n}"
diff --git a/tests/lib/styles/fixtures/index/scss-interpolation01-selector/source.vue b/tests/lib/styles/fixtures/index/scss-interpolation01-selector/source.vue
index e47a8b85..8f43c4ee 100644
--- a/tests/lib/styles/fixtures/index/scss-interpolation01-selector/source.vue
+++ b/tests/lib/styles/fixtures/index/scss-interpolation01-selector/source.vue
@@ -12,7 +12,7 @@ span.emoji-#{$name} {
tag#{$tag}
##{$id}
.#{$class}class[#{$attr}]
-[attr=#{$attr-val}]
+[attr=#{$attr-val}] // #{comment}
::pseudo#{$pseudo}
:pseudo2#{$pseudo}
::fn( .#{$in-pseudo} )
diff --git a/tests/lib/styles/fixtures/index/scss-sample01/ast.json b/tests/lib/styles/fixtures/index/scss-sample01/ast.json
index 2c2053c8..c096fa51 100644
--- a/tests/lib/styles/fixtures/index/scss-sample01/ast.json
+++ b/tests/lib/styles/fixtures/index/scss-sample01/ast.json
@@ -613,6 +613,7 @@
422
],
"name": "import",
+ "identifier": "@",
"paramsText": "'reset'",
"rawParamsText": "'reset'",
"nodes": []
@@ -747,6 +748,7 @@
623
],
"name": "mixin",
+ "identifier": "@",
"paramsText": "transform($property)",
"rawParamsText": "transform($property)",
"nodes": [
@@ -902,6 +904,7 @@
665
],
"name": "include",
+ "identifier": "@",
"paramsText": "transform(rotate(30deg))",
"rawParamsText": "transform(rotate(30deg))",
"nodes": []
@@ -1236,6 +1239,7 @@
992
],
"name": "extend",
+ "identifier": "@",
"paramsText": "%message-shared",
"rawParamsText": "%message-shared",
"nodes": []
@@ -1326,6 +1330,7 @@
1033
],
"name": "extend",
+ "identifier": "@",
"paramsText": "%message-shared",
"rawParamsText": "%message-shared",
"nodes": []
@@ -1438,6 +1443,7 @@
1095
],
"name": "extend",
+ "identifier": "@",
"paramsText": "%message-shared",
"rawParamsText": "%message-shared",
"nodes": []
@@ -1550,6 +1556,7 @@
1157
],
"name": "extend",
+ "identifier": "@",
"paramsText": "%message-shared",
"rawParamsText": "%message-shared",
"nodes": []
diff --git a/tests/lib/styles/fixtures/index/stylus-@nest01/ast.json b/tests/lib/styles/fixtures/index/stylus-@nest01/ast.json
new file mode 100644
index 00000000..436f9db6
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-@nest01/ast.json
@@ -0,0 +1,223 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 8,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 100,
+ "range": [
+ 63,
+ 100
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "start": 64,
+ "end": 99,
+ "range": [
+ 64,
+ 99
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "start": 71,
+ "end": 99,
+ "range": [
+ 71,
+ 99
+ ],
+ "name": "nest",
+ "identifier": "@",
+ "paramsText": "& > .bar",
+ "rawParamsText": "& > .bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 16
+ }
+ },
+ "start": 77,
+ "end": 85,
+ "range": [
+ 77,
+ 85
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 8
+ },
+ "end": {
+ "line": 6,
+ "column": 9
+ }
+ },
+ "start": 77,
+ "end": 78,
+ "range": [
+ 77,
+ 78
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 10
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "start": 79,
+ "end": 80,
+ "range": [
+ 79,
+ 80
+ ],
+ "value": ">",
+ "selector": ">"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 16
+ }
+ },
+ "start": 81,
+ "end": 85,
+ "range": [
+ 81,
+ 85
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "start": 90,
+ "end": 99,
+ "range": [
+ 90,
+ 99
+ ],
+ "property": "color",
+ "value": "red",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-@nest01/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-@nest01/selectors-text.json
new file mode 100644
index 00000000..b144c019
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-@nest01/selectors-text.json
@@ -0,0 +1,10 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo",
+ ">",
+ ".bar"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-@nest01/selectors.json b/tests/lib/styles/fixtures/index/stylus-@nest01/selectors.json
new file mode 100644
index 00000000..de0e1f49
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-@nest01/selectors.json
@@ -0,0 +1,90 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 10
+ },
+ "end": {
+ "line": 6,
+ "column": 11
+ }
+ },
+ "start": 79,
+ "end": 80,
+ "range": [
+ 79,
+ 80
+ ],
+ "value": ">",
+ "selector": ">"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 12
+ },
+ "end": {
+ "line": 6,
+ "column": 16
+ }
+ },
+ "start": 81,
+ "end": 85,
+ "range": [
+ 81,
+ 85
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-@nest01/source.vue b/tests/lib/styles/fixtures/index/stylus-@nest01/source.vue
new file mode 100644
index 00000000..44fe034f
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-@nest01/source.vue
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-comments01/ast.json b/tests/lib/styles/fixtures/index/stylus-comments01/ast.json
new file mode 100644
index 00000000..3aea2abf
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments01/ast.json
@@ -0,0 +1,260 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 12,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 148,
+ "range": [
+ 63,
+ 148
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 90,
+ "end": 131,
+ "range": [
+ 90,
+ 131
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 90,
+ "end": 94,
+ "range": [
+ 90,
+ 94
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 90,
+ "end": 94,
+ "range": [
+ 90,
+ 94
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 97,
+ "end": 131,
+ "range": [
+ 97,
+ 131
+ ],
+ "selectorText": ".bar",
+ "rawSelectorText": ".bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 6
+ }
+ },
+ "start": 97,
+ "end": 101,
+ "range": [
+ 97,
+ 101
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 6
+ }
+ },
+ "start": 97,
+ "end": 101,
+ "range": [
+ 97,
+ 101
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 120,
+ "end": 131,
+ "range": [
+ 120,
+ 131
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "start": 64,
+ "end": 75,
+ "range": [
+ 64,
+ 75
+ ],
+ "text": "comment1"
+ },
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 13
+ }
+ },
+ "start": 76,
+ "end": 89,
+ "range": [
+ 76,
+ 89
+ ],
+ "text": "{comment2}"
+ },
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 7
+ },
+ "end": {
+ "line": 8,
+ "column": 20
+ }
+ },
+ "start": 102,
+ "end": 115,
+ "range": [
+ 102,
+ 115
+ ],
+ "text": "{comment3}"
+ },
+ {
+ "type": "VCSSComment",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 14
+ }
+ },
+ "start": 133,
+ "end": 147,
+ "range": [
+ 133,
+ 147
+ ],
+ "text": "comment4"
+ }
+ ],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-comments01/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-comments01/selectors-text.json
new file mode 100644
index 00000000..9eb254c9
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments01/selectors-text.json
@@ -0,0 +1,10 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-comments01/selectors.json b/tests/lib/styles/fixtures/index/stylus-comments01/selectors.json
new file mode 100644
index 00000000..5c51cdf8
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments01/selectors.json
@@ -0,0 +1,90 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 90,
+ "end": 94,
+ "range": [
+ 90,
+ 94
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 90,
+ "end": 94,
+ "range": [
+ 90,
+ 94
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 2
+ }
+ },
+ "start": 97,
+ "end": 97,
+ "range": [
+ 97,
+ 97
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 6
+ }
+ },
+ "start": 97,
+ "end": 101,
+ "range": [
+ 97,
+ 101
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-comments01/source.vue b/tests/lib/styles/fixtures/index/stylus-comments01/source.vue
new file mode 100644
index 00000000..a2d4a170
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments01/source.vue
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/ast.json b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/ast.json
new file mode 100644
index 00000000..7bd92192
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/ast.json
@@ -0,0 +1,386 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 13,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 173,
+ "range": [
+ 63,
+ 173
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 15
+ }
+ },
+ "start": 64,
+ "end": 171,
+ "range": [
+ 64,
+ 171
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 11,
+ "column": 15
+ }
+ },
+ "start": 71,
+ "end": 171,
+ "range": [
+ 71,
+ 171
+ ],
+ "selectorText": ".bar \n ,.baz, \n .qux, \n\n .quux",
+ "rawSelectorText": ".bar // {comment1}\n .baz, // {comment2}\n .qux, /* comment3 */\n// comment 4\n .quux",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 92,
+ "end": 96,
+ "range": [
+ 92,
+ 96
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 92,
+ "end": 96,
+ "range": [
+ 92,
+ 96
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 6
+ }
+ },
+ "start": 114,
+ "end": 118,
+ "range": [
+ 114,
+ 118
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 6
+ }
+ },
+ "start": 114,
+ "end": 118,
+ "range": [
+ 114,
+ 118
+ ],
+ "value": "qux",
+ "selector": ".qux"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 7
+ }
+ },
+ "start": 150,
+ "end": 155,
+ "range": [
+ 150,
+ 155
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 7
+ }
+ },
+ "start": 150,
+ "end": 155,
+ "range": [
+ 150,
+ 155
+ ],
+ "value": "quux",
+ "selector": ".quux"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 15
+ }
+ },
+ "start": 160,
+ "end": 171,
+ "range": [
+ 160,
+ 171
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 7
+ },
+ "end": {
+ "line": 6,
+ "column": 20
+ }
+ },
+ "start": 76,
+ "end": 89,
+ "range": [
+ 76,
+ 89
+ ],
+ "text": " {comment1}"
+ },
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 1
+ }
+ },
+ "start": 98,
+ "end": 113,
+ "range": [
+ 98,
+ 113
+ ],
+ "text": " {comment2}"
+ },
+ {
+ "type": "VCSSComment",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 22
+ }
+ },
+ "start": 120,
+ "end": 134,
+ "range": [
+ 120,
+ 134
+ ],
+ "text": " comment3 "
+ },
+ {
+ "type": "VCSSInlineComment",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 1
+ },
+ "end": {
+ "line": 10,
+ "column": 0
+ }
+ },
+ "start": 136,
+ "end": 148,
+ "range": [
+ 136,
+ 148
+ ],
+ "text": " comment 4"
+ }
+ ],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/selectors-text.json
new file mode 100644
index 00000000..d09cc06d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/selectors-text.json
@@ -0,0 +1,25 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ],
+ [
+ ".foo",
+ " ",
+ ".baz"
+ ],
+ [
+ ".foo",
+ " ",
+ ".qux"
+ ],
+ [
+ ".foo",
+ " ",
+ ".quux"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/selectors.json b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/selectors.json
new file mode 100644
index 00000000..16c58a43
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/selectors.json
@@ -0,0 +1,285 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 71,
+ "end": 71,
+ "range": [
+ 71,
+ 71
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 2
+ }
+ },
+ "start": 92,
+ "end": 92,
+ "range": [
+ 92,
+ 92
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 92,
+ "end": 96,
+ "range": [
+ 92,
+ 96
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 2
+ }
+ },
+ "start": 114,
+ "end": 114,
+ "range": [
+ 114,
+ 114
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 6
+ }
+ },
+ "start": 114,
+ "end": 118,
+ "range": [
+ 114,
+ 118
+ ],
+ "value": "qux",
+ "selector": ".qux"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 2
+ }
+ },
+ "start": 150,
+ "end": 150,
+ "range": [
+ 150,
+ 150
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 7
+ }
+ },
+ "start": 150,
+ "end": 155,
+ "range": [
+ 150,
+ 155
+ ],
+ "value": "quux",
+ "selector": ".quux"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/source.vue b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/source.vue
new file mode 100644
index 00000000..e8d5520f
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-comments02-in-selector/source.vue
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting01/ast.json b/tests/lib/styles/fixtures/index/stylus-nesting01/ast.json
new file mode 100644
index 00000000..8b167106
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting01/ast.json
@@ -0,0 +1,284 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 8,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 104,
+ "range": [
+ 63,
+ 104
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 18
+ }
+ },
+ "start": 64,
+ "end": 103,
+ "range": [
+ 64,
+ 103
+ ],
+ "selectorText": "foo bar baz",
+ "rawSelectorText": "foo bar baz",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "start": 64,
+ "end": 75,
+ "range": [
+ 64,
+ 75
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 3
+ }
+ },
+ "start": 64,
+ "end": 67,
+ "range": [
+ 64,
+ 67
+ ],
+ "value": "foo",
+ "selector": "foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 3
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 67,
+ "end": 68,
+ "range": [
+ 67,
+ 68
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 7
+ }
+ },
+ "start": 68,
+ "end": 71,
+ "range": [
+ 68,
+ 71
+ ],
+ "value": "bar",
+ "selector": "bar"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 7
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "start": 72,
+ "end": 75,
+ "range": [
+ 72,
+ 75
+ ],
+ "value": "baz",
+ "selector": "baz"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 7,
+ "column": 18
+ }
+ },
+ "start": 77,
+ "end": 103,
+ "range": [
+ 77,
+ 103
+ ],
+ "selectorText": "> input",
+ "rawSelectorText": "> input",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 77,
+ "end": 84,
+ "range": [
+ 77,
+ 84
+ ],
+ "nodes": [
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 77,
+ "end": 78,
+ "range": [
+ 77,
+ 78
+ ],
+ "value": ">",
+ "selector": ">"
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 79,
+ "end": 84,
+ "range": [
+ 79,
+ 84
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 18
+ }
+ },
+ "start": 87,
+ "end": 103,
+ "range": [
+ 87,
+ 103
+ ],
+ "property": "border",
+ "value": "1px solid",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting01/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-nesting01/selectors-text.json
new file mode 100644
index 00000000..2359f43e
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting01/selectors-text.json
@@ -0,0 +1,18 @@
+[
+ [
+ "foo",
+ " ",
+ "bar",
+ " ",
+ "baz"
+ ],
+ [
+ "foo",
+ " ",
+ "bar",
+ " ",
+ "baz",
+ ">",
+ "input"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting01/selectors.json b/tests/lib/styles/fixtures/index/stylus-nesting01/selectors.json
new file mode 100644
index 00000000..5ff01d06
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting01/selectors.json
@@ -0,0 +1,258 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 3
+ }
+ },
+ "start": 64,
+ "end": 67,
+ "range": [
+ 64,
+ 67
+ ],
+ "value": "foo",
+ "selector": "foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 3
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 67,
+ "end": 68,
+ "range": [
+ 67,
+ 68
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 7
+ }
+ },
+ "start": 68,
+ "end": 71,
+ "range": [
+ 68,
+ 71
+ ],
+ "value": "bar",
+ "selector": "bar"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 7
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "start": 72,
+ "end": 75,
+ "range": [
+ 72,
+ 75
+ ],
+ "value": "baz",
+ "selector": "baz"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 3
+ }
+ },
+ "start": 64,
+ "end": 67,
+ "range": [
+ 64,
+ 67
+ ],
+ "value": "foo",
+ "selector": "foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 3
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 67,
+ "end": 68,
+ "range": [
+ 67,
+ 68
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 4
+ },
+ "end": {
+ "line": 5,
+ "column": 7
+ }
+ },
+ "start": 68,
+ "end": 71,
+ "range": [
+ 68,
+ 71
+ ],
+ "value": "bar",
+ "selector": "bar"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 7
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 8
+ },
+ "end": {
+ "line": 5,
+ "column": 11
+ }
+ },
+ "start": 72,
+ "end": 75,
+ "range": [
+ 72,
+ 75
+ ],
+ "value": "baz",
+ "selector": "baz"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 1
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 77,
+ "end": 78,
+ "range": [
+ 77,
+ 78
+ ],
+ "value": ">",
+ "selector": ">"
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 79,
+ "end": 84,
+ "range": [
+ 79,
+ 84
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting01/source.vue b/tests/lib/styles/fixtures/index/stylus-nesting01/source.vue
new file mode 100644
index 00000000..28a6191d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting01/source.vue
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting02-comb/ast.json b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/ast.json
new file mode 100644
index 00000000..e613aebf
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/ast.json
@@ -0,0 +1,242 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 9,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 101,
+ "range": [
+ 63,
+ 101
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 14
+ }
+ },
+ "start": 64,
+ "end": 100,
+ "range": [
+ 64,
+ 100
+ ],
+ "selectorText": "textarea\n,input >",
+ "rawSelectorText": "textarea\ninput >",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "start": 73,
+ "end": 80,
+ "range": [
+ 73,
+ 80
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "start": 79,
+ "end": 80,
+ "range": [
+ 79,
+ 80
+ ],
+ "value": ">",
+ "selector": ">"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 14
+ }
+ },
+ "start": 83,
+ "end": 100,
+ "range": [
+ 83,
+ 100
+ ],
+ "selectorText": ".a",
+ "rawSelectorText": ".a",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 83,
+ "end": 85,
+ "range": [
+ 83,
+ 85
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 83,
+ "end": 85,
+ "range": [
+ 83,
+ 85
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 14
+ }
+ },
+ "start": 90,
+ "end": 100,
+ "range": [
+ 90,
+ 100
+ ],
+ "property": "color",
+ "value": "#000",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting02-comb/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/selectors-text.json
new file mode 100644
index 00000000..b2e9e11b
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/selectors-text.json
@@ -0,0 +1,19 @@
+[
+ [
+ "textarea"
+ ],
+ [
+ "input",
+ ">"
+ ],
+ [
+ "textarea",
+ " ",
+ ".a"
+ ],
+ [
+ "input",
+ ">",
+ ".a"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting02-comb/selectors.json b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/selectors.json
new file mode 100644
index 00000000..91dc288d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/selectors.json
@@ -0,0 +1,199 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "start": 79,
+ "end": 80,
+ "range": [
+ 79,
+ 80
+ ],
+ "value": ">",
+ "selector": ">"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 2
+ }
+ },
+ "start": 83,
+ "end": 83,
+ "range": [
+ 83,
+ 83
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 83,
+ "end": 85,
+ "range": [
+ 83,
+ 85
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 6
+ },
+ "end": {
+ "line": 6,
+ "column": 7
+ }
+ },
+ "start": 79,
+ "end": 80,
+ "range": [
+ 79,
+ 80
+ ],
+ "value": ">",
+ "selector": ">"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 83,
+ "end": 85,
+ "range": [
+ 83,
+ 85
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-nesting02-comb/source.vue b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/source.vue
new file mode 100644
index 00000000..bda3695f
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-nesting02-comb/source.vue
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/ast.json b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/ast.json
new file mode 100644
index 00000000..e399ce2c
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/ast.json
@@ -0,0 +1,285 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 11,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 144,
+ "range": [
+ 63,
+ 144
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "start": 64,
+ "end": 102,
+ "range": [
+ 64,
+ 102
+ ],
+ "selectorText": "textarea\n,input",
+ "rawSelectorText": "textarea\ninput",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "start": 81,
+ "end": 102,
+ "range": [
+ 81,
+ 102
+ ],
+ "property": "border",
+ "value": "1px solid #eee",
+ "important": false
+ }
+ ]
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 23
+ }
+ },
+ "start": 104,
+ "end": 143,
+ "range": [
+ 104,
+ 143
+ ],
+ "selectorText": "textarea, input",
+ "rawSelectorText": "textarea, input",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 0
+ },
+ "end": {
+ "line": 9,
+ "column": 8
+ }
+ },
+ "start": 104,
+ "end": 112,
+ "range": [
+ 104,
+ 112
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 0
+ },
+ "end": {
+ "line": 9,
+ "column": 8
+ }
+ },
+ "start": 104,
+ "end": 112,
+ "range": [
+ 104,
+ 112
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 10
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 114,
+ "end": 119,
+ "range": [
+ 114,
+ 119
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 10
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 114,
+ "end": 119,
+ "range": [
+ 114,
+ 119
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 23
+ }
+ },
+ "start": 122,
+ "end": 143,
+ "range": [
+ 122,
+ 143
+ ],
+ "property": "border",
+ "value": "1px solid #eee",
+ "important": false
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/selectors-text.json
new file mode 100644
index 00000000..99a1850e
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/selectors-text.json
@@ -0,0 +1,14 @@
+[
+ [
+ "textarea"
+ ],
+ [
+ "input"
+ ],
+ [
+ "textarea"
+ ],
+ [
+ "input"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/selectors.json
new file mode 100644
index 00000000..3c3bf19c
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/selectors.json
@@ -0,0 +1,94 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 0
+ },
+ "end": {
+ "line": 9,
+ "column": 8
+ }
+ },
+ "start": 104,
+ "end": 112,
+ "range": [
+ 104,
+ 112
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 10
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 114,
+ "end": 119,
+ "range": [
+ 114,
+ 119
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/source.vue b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/source.vue
new file mode 100644
index 00000000..f14c4fd5
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector01-ruleset/source.vue
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/ast.json
new file mode 100644
index 00000000..f0d4d170
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/ast.json
@@ -0,0 +1,264 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 10,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 120,
+ "range": [
+ 63,
+ 120
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 64,
+ "end": 119,
+ "range": [
+ 64,
+ 119
+ ],
+ "selectorText": "textarea\n,input",
+ "rawSelectorText": "textarea\ninput",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "start": 81,
+ "end": 94,
+ "range": [
+ 81,
+ 94
+ ],
+ "property": "color",
+ "value": "#A7A7A7",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 97,
+ "end": 119,
+ "range": [
+ 97,
+ 119
+ ],
+ "selectorText": "&:hover",
+ "rawSelectorText": "&:hover",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 97,
+ "end": 104,
+ "range": [
+ 97,
+ 104
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 3
+ }
+ },
+ "start": 97,
+ "end": 98,
+ "range": [
+ 97,
+ 98
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 3
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 98,
+ "end": 104,
+ "range": [
+ 98,
+ 104
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 109,
+ "end": 119,
+ "range": [
+ 109,
+ 119
+ ],
+ "property": "color",
+ "value": "#000",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/selectors-text.json
new file mode 100644
index 00000000..843798c6
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/selectors-text.json
@@ -0,0 +1,16 @@
+[
+ [
+ "textarea"
+ ],
+ [
+ "input"
+ ],
+ [
+ "textarea",
+ ":hover"
+ ],
+ [
+ "input",
+ ":hover"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/selectors.json
new file mode 100644
index 00000000..3927397a
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/selectors.json
@@ -0,0 +1,136 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 3
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 98,
+ "end": 104,
+ "range": [
+ 98,
+ 104
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 3
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 98,
+ "end": 104,
+ "range": [
+ 98,
+ 104
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/source.vue
new file mode 100644
index 00000000..1a8804a3
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector02-parent-ref/source.vue
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/ast.json
new file mode 100644
index 00000000..ede0b92d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/ast.json
@@ -0,0 +1,352 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 11,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 130,
+ "range": [
+ 63,
+ 130
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 64,
+ "end": 129,
+ "range": [
+ 64,
+ 129
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 71,
+ "end": 129,
+ "range": [
+ 71,
+ 129
+ ],
+ "selectorText": "&__bar",
+ "rawSelectorText": "&__bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 3
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 72,
+ "end": 77,
+ "range": [
+ 72,
+ 77
+ ],
+ "value": "__bar",
+ "selector": "__bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "start": 82,
+ "end": 93,
+ "range": [
+ 82,
+ 93
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 99,
+ "end": 129,
+ "range": [
+ 99,
+ 129
+ ],
+ "selectorText": "^[0]:hover &",
+ "rawSelectorText": "^[0]:hover &",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 16
+ }
+ },
+ "start": 99,
+ "end": 111,
+ "range": [
+ 99,
+ 111
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 8
+ }
+ },
+ "start": 99,
+ "end": 103,
+ "range": [
+ 99,
+ 103
+ ],
+ "value": "^[0]",
+ "selector": "^[0]"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 8
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 103,
+ "end": 109,
+ "range": [
+ 103,
+ 109
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 14
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 109,
+ "end": 110,
+ "range": [
+ 109,
+ 110
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 15
+ },
+ "end": {
+ "line": 9,
+ "column": 16
+ }
+ },
+ "start": 110,
+ "end": 111,
+ "range": [
+ 110,
+ 111
+ ],
+ "value": "&",
+ "selector": "&"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 118,
+ "end": 129,
+ "range": [
+ 118,
+ 129
+ ],
+ "property": "width",
+ "value": "20px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/selectors-text.json
new file mode 100644
index 00000000..c1b578ca
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/selectors-text.json
@@ -0,0 +1,14 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo__bar"
+ ],
+ [
+ ".foo",
+ ":hover",
+ " ",
+ ".foo__bar"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/selectors.json
new file mode 100644
index 00000000..e61b355e
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/selectors.json
@@ -0,0 +1,134 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "value": "foo__bar",
+ "selector": ".foo__bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 8
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 103,
+ "end": 109,
+ "range": [
+ 103,
+ 109
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 14
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 109,
+ "end": 110,
+ "range": [
+ 109,
+ 110
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "value": "foo__bar",
+ "selector": ".foo__bar"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/source.vue
new file mode 100644
index 00000000..ce10264b
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector03-partial-ref/source.vue
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/ast.json b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/ast.json
new file mode 100644
index 00000000..9910e798
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/ast.json
@@ -0,0 +1,440 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 12,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 147,
+ "range": [
+ 63,
+ 147
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 19
+ }
+ },
+ "start": 64,
+ "end": 146,
+ "range": [
+ 64,
+ 146
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 11,
+ "column": 19
+ }
+ },
+ "start": 71,
+ "end": 146,
+ "range": [
+ 71,
+ 146
+ ],
+ "selectorText": "&__bar",
+ "rawSelectorText": "&__bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 3
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 72,
+ "end": 77,
+ "range": [
+ 72,
+ 77
+ ],
+ "value": "__bar",
+ "selector": "__bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 19
+ }
+ },
+ "start": 82,
+ "end": 146,
+ "range": [
+ 82,
+ 146
+ ],
+ "selectorText": "&_baz",
+ "rawSelectorText": "&_baz",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "start": 82,
+ "end": 87,
+ "range": [
+ 82,
+ 87
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 5
+ }
+ },
+ "start": 82,
+ "end": 83,
+ "range": [
+ 82,
+ 83
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 5
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "start": 83,
+ "end": 87,
+ "range": [
+ 83,
+ 87
+ ],
+ "value": "_baz",
+ "selector": "_baz"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 6
+ },
+ "end": {
+ "line": 8,
+ "column": 17
+ }
+ },
+ "start": 94,
+ "end": 105,
+ "range": [
+ 94,
+ 105
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 11,
+ "column": 19
+ }
+ },
+ "start": 113,
+ "end": 146,
+ "range": [
+ 113,
+ 146
+ ],
+ "selectorText": "^[-1]:hover &",
+ "rawSelectorText": "^[-1]:hover &",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 19
+ }
+ },
+ "start": 113,
+ "end": 126,
+ "range": [
+ 113,
+ 126
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 11
+ }
+ },
+ "start": 113,
+ "end": 118,
+ "range": [
+ 113,
+ 118
+ ],
+ "value": "^[-1]",
+ "selector": "^[-1]"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 118,
+ "end": 124,
+ "range": [
+ 118,
+ 124
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 17
+ },
+ "end": {
+ "line": 10,
+ "column": 18
+ }
+ },
+ "start": 124,
+ "end": 125,
+ "range": [
+ 124,
+ 125
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 18
+ },
+ "end": {
+ "line": 10,
+ "column": 19
+ }
+ },
+ "start": 125,
+ "end": 126,
+ "range": [
+ 125,
+ 126
+ ],
+ "value": "&",
+ "selector": "&"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 8
+ },
+ "end": {
+ "line": 11,
+ "column": 19
+ }
+ },
+ "start": 135,
+ "end": 146,
+ "range": [
+ 135,
+ 146
+ ],
+ "property": "width",
+ "value": "20px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/selectors-text.json
new file mode 100644
index 00000000..5034e9d6
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/selectors-text.json
@@ -0,0 +1,17 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo__bar"
+ ],
+ [
+ ".foo__bar_baz"
+ ],
+ [
+ ".foo__bar",
+ ":hover",
+ " ",
+ ".foo__bar_baz"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/selectors.json
new file mode 100644
index 00000000..6425ddf3
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/selectors.json
@@ -0,0 +1,157 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "value": "foo__bar",
+ "selector": ".foo__bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "start": 82,
+ "end": 87,
+ "range": [
+ 82,
+ 87
+ ],
+ "value": "foo__bar_baz",
+ "selector": ".foo__bar_baz"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "value": "foo__bar",
+ "selector": ".foo__bar"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 118,
+ "end": 124,
+ "range": [
+ 118,
+ 124
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 17
+ },
+ "end": {
+ "line": 10,
+ "column": 18
+ }
+ },
+ "start": 124,
+ "end": 125,
+ "range": [
+ 124,
+ 125
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 9
+ }
+ },
+ "start": 82,
+ "end": 87,
+ "range": [
+ 82,
+ 87
+ ],
+ "value": "foo__bar_baz",
+ "selector": ".foo__bar_baz"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/source.vue b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/source.vue
new file mode 100644
index 00000000..7ced2885
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector04-partial-ref-minus/source.vue
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/ast.json
new file mode 100644
index 00000000..a3e978c4
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/ast.json
@@ -0,0 +1,373 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 11,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 137,
+ "range": [
+ 63,
+ 137
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 64,
+ "end": 136,
+ "range": [
+ 64,
+ 136
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 71,
+ "end": 136,
+ "range": [
+ 71,
+ 136
+ ],
+ "selectorText": "& .bar",
+ "rawSelectorText": "& .bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 71,
+ "end": 77,
+ "range": [
+ 71,
+ 77
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 3
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 72,
+ "end": 73,
+ "range": [
+ 72,
+ 73
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 73,
+ "end": 77,
+ "range": [
+ 73,
+ 77
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "start": 82,
+ "end": 93,
+ "range": [
+ 82,
+ 93
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 99,
+ "end": 136,
+ "range": [
+ 99,
+ 136
+ ],
+ "selectorText": "^[0]:hover ^[1..-1]",
+ "rawSelectorText": "^[0]:hover ^[1..-1]",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 23
+ }
+ },
+ "start": 99,
+ "end": 118,
+ "range": [
+ 99,
+ 118
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 8
+ }
+ },
+ "start": 99,
+ "end": 103,
+ "range": [
+ 99,
+ 103
+ ],
+ "value": "^[0]",
+ "selector": "^[0]"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 8
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 103,
+ "end": 109,
+ "range": [
+ 103,
+ 109
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 14
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 109,
+ "end": 110,
+ "range": [
+ 109,
+ 110
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 15
+ },
+ "end": {
+ "line": 9,
+ "column": 23
+ }
+ },
+ "start": 110,
+ "end": 118,
+ "range": [
+ 110,
+ 118
+ ],
+ "value": "^[1..-1]",
+ "selector": "^[1..-1]"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 125,
+ "end": 136,
+ "range": [
+ 125,
+ 136
+ ],
+ "property": "width",
+ "value": "20px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/selectors-text.json
new file mode 100644
index 00000000..d474147d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/selectors-text.json
@@ -0,0 +1,16 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ],
+ [
+ ".foo",
+ ":hover",
+ " ",
+ ".bar"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/selectors.json
new file mode 100644
index 00000000..b07e93e3
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/selectors.json
@@ -0,0 +1,176 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 72,
+ "end": 73,
+ "range": [
+ 72,
+ 73
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 73,
+ "end": 77,
+ "range": [
+ 73,
+ 77
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 8
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 103,
+ "end": 109,
+ "range": [
+ 103,
+ 109
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 14
+ },
+ "end": {
+ "line": 9,
+ "column": 15
+ }
+ },
+ "start": 109,
+ "end": 110,
+ "range": [
+ 109,
+ 110
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 8
+ }
+ },
+ "start": 73,
+ "end": 77,
+ "range": [
+ 73,
+ 77
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/source.vue
new file mode 100644
index 00000000..3a75f4f6
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector05-range-partial-ref/source.vue
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/ast.json
new file mode 100644
index 00000000..c64f8397
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/ast.json
@@ -0,0 +1,461 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 13,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 161,
+ "range": [
+ 63,
+ 161
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 12,
+ "column": 19
+ }
+ },
+ "start": 64,
+ "end": 160,
+ "range": [
+ 64,
+ 160
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 12,
+ "column": 19
+ }
+ },
+ "start": 71,
+ "end": 160,
+ "range": [
+ 71,
+ 160
+ ],
+ "selectorText": ".bar",
+ "rawSelectorText": ".bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 19
+ }
+ },
+ "start": 80,
+ "end": 160,
+ "range": [
+ 80,
+ 160
+ ],
+ "selectorText": ".baz",
+ "rawSelectorText": ".baz",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 80,
+ "end": 84,
+ "range": [
+ 80,
+ 84
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 80,
+ "end": 84,
+ "range": [
+ 80,
+ 84
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 6
+ },
+ "end": {
+ "line": 8,
+ "column": 17
+ }
+ },
+ "start": 91,
+ "end": 102,
+ "range": [
+ 91,
+ 102
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 12,
+ "column": 19
+ }
+ },
+ "start": 110,
+ "end": 160,
+ "range": [
+ 110,
+ 160
+ ],
+ "selectorText": ".a ^[1..-1]\n ,.b ^[-2..-1]",
+ "rawSelectorText": ".a ^[1..-1]\n .b ^[-2..-1]",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 17
+ }
+ },
+ "start": 110,
+ "end": 121,
+ "range": [
+ 110,
+ 121
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "start": 110,
+ "end": 112,
+ "range": [
+ 110,
+ 112
+ ],
+ "value": "a",
+ "selector": ".a"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 9
+ }
+ },
+ "start": 112,
+ "end": 113,
+ "range": [
+ 112,
+ 113
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 9
+ },
+ "end": {
+ "line": 11,
+ "column": 5
+ }
+ },
+ "start": 113,
+ "end": 127,
+ "range": [
+ 113,
+ 127
+ ],
+ "value": "^[1..-1]",
+ "selector": "^[1..-1]"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 6
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 128,
+ "end": 140,
+ "range": [
+ 128,
+ 140
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 6
+ },
+ "end": {
+ "line": 11,
+ "column": 8
+ }
+ },
+ "start": 128,
+ "end": 130,
+ "range": [
+ 128,
+ 130
+ ],
+ "value": "b",
+ "selector": ".b"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 8
+ },
+ "end": {
+ "line": 11,
+ "column": 9
+ }
+ },
+ "start": 130,
+ "end": 131,
+ "range": [
+ 130,
+ 131
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 9
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 131,
+ "end": 140,
+ "range": [
+ 131,
+ 140
+ ],
+ "value": "^[-2..-1]",
+ "selector": "^[-2..-1]"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 8
+ },
+ "end": {
+ "line": 12,
+ "column": 19
+ }
+ },
+ "start": 149,
+ "end": 160,
+ "range": [
+ 149,
+ 160
+ ],
+ "property": "width",
+ "value": "20px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/selectors-text.json
new file mode 100644
index 00000000..a78a20f7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/selectors-text.json
@@ -0,0 +1,31 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar",
+ " ",
+ ".baz"
+ ],
+ [
+ ".a",
+ " ",
+ ".bar",
+ " ",
+ ".baz"
+ ],
+ [
+ ".b",
+ " ",
+ ".bar",
+ " ",
+ ".baz"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/selectors.json
new file mode 100644
index 00000000..6204a777
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/selectors.json
@@ -0,0 +1,411 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 71,
+ "end": 71,
+ "range": [
+ 71,
+ 71
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 71,
+ "end": 71,
+ "range": [
+ 71,
+ 71
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 80,
+ "end": 80,
+ "range": [
+ 80,
+ 80
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 80,
+ "end": 84,
+ "range": [
+ 80,
+ 84
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "start": 110,
+ "end": 112,
+ "range": [
+ 110,
+ 112
+ ],
+ "value": "a",
+ "selector": ".a"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 9
+ }
+ },
+ "start": 112,
+ "end": 113,
+ "range": [
+ 112,
+ 113
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 80,
+ "end": 80,
+ "range": [
+ 80,
+ 80
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 80,
+ "end": 84,
+ "range": [
+ 80,
+ 84
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 6
+ },
+ "end": {
+ "line": 11,
+ "column": 8
+ }
+ },
+ "start": 128,
+ "end": 130,
+ "range": [
+ 128,
+ 130
+ ],
+ "value": "b",
+ "selector": ".b"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 8
+ },
+ "end": {
+ "line": 11,
+ "column": 9
+ }
+ },
+ "start": 130,
+ "end": 131,
+ "range": [
+ 130,
+ 131
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 80,
+ "end": 80,
+ "range": [
+ 80,
+ 80
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 80,
+ "end": 84,
+ "range": [
+ 80,
+ 84
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/source.vue
new file mode 100644
index 00000000..bdd4dec7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector06-range-partial-ref/source.vue
@@ -0,0 +1,13 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/ast.json
new file mode 100644
index 00000000..89feb687
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/ast.json
@@ -0,0 +1,330 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 9,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 116,
+ "range": [
+ 63,
+ 116
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 16
+ }
+ },
+ "start": 64,
+ "end": 115,
+ "range": [
+ 64,
+ 115
+ ],
+ "selectorText": ".block",
+ "rawSelectorText": ".block",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "start": 64,
+ "end": 70,
+ "range": [
+ 64,
+ 70
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "start": 64,
+ "end": 70,
+ "range": [
+ 64,
+ 70
+ ],
+ "value": "block",
+ "selector": ".block"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 16
+ }
+ },
+ "start": 73,
+ "end": 115,
+ "range": [
+ 73,
+ 115
+ ],
+ "selectorText": "&__element",
+ "rawSelectorText": "&__element",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ },
+ "start": 73,
+ "end": 83,
+ "range": [
+ 73,
+ 83
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 3
+ }
+ },
+ "start": 73,
+ "end": 74,
+ "range": [
+ 73,
+ 74
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 3
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ },
+ "start": 74,
+ "end": 83,
+ "range": [
+ 74,
+ 83
+ ],
+ "value": "__element",
+ "selector": "__element"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 16
+ }
+ },
+ "start": 88,
+ "end": 115,
+ "range": [
+ 88,
+ 115
+ ],
+ "selectorText": "~/:hover &",
+ "rawSelectorText": "~/:hover &",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 14
+ }
+ },
+ "start": 88,
+ "end": 98,
+ "range": [
+ 88,
+ 98
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 88,
+ "end": 90,
+ "range": [
+ 88,
+ 90
+ ],
+ "value": "~/",
+ "selector": "~/"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 6
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "start": 90,
+ "end": 96,
+ "range": [
+ 90,
+ 96
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "start": 96,
+ "end": 97,
+ "range": [
+ 96,
+ 97
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 13
+ },
+ "end": {
+ "line": 7,
+ "column": 14
+ }
+ },
+ "start": 97,
+ "end": 98,
+ "range": [
+ 97,
+ 98
+ ],
+ "value": "&",
+ "selector": "&"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 6
+ },
+ "end": {
+ "line": 8,
+ "column": 16
+ }
+ },
+ "start": 105,
+ "end": 115,
+ "range": [
+ 105,
+ 115
+ ],
+ "property": "color",
+ "value": "red",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/selectors-text.json
new file mode 100644
index 00000000..c85a16aa
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/selectors-text.json
@@ -0,0 +1,14 @@
+[
+ [
+ ".block"
+ ],
+ [
+ ".block__element"
+ ],
+ [
+ ".block",
+ ":hover",
+ " ",
+ ".block__element"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/selectors.json
new file mode 100644
index 00000000..e02317b4
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/selectors.json
@@ -0,0 +1,134 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "start": 64,
+ "end": 70,
+ "range": [
+ 64,
+ 70
+ ],
+ "value": "block",
+ "selector": ".block"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ },
+ "start": 73,
+ "end": 83,
+ "range": [
+ 73,
+ 83
+ ],
+ "value": "block__element",
+ "selector": ".block__element"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 6
+ }
+ },
+ "start": 64,
+ "end": 70,
+ "range": [
+ 64,
+ 70
+ ],
+ "value": "block",
+ "selector": ".block"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 6
+ },
+ "end": {
+ "line": 7,
+ "column": 12
+ }
+ },
+ "start": 90,
+ "end": 96,
+ "range": [
+ 90,
+ 96
+ ],
+ "value": ":hover",
+ "nodes": []
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 12
+ },
+ "end": {
+ "line": 7,
+ "column": 13
+ }
+ },
+ "start": 96,
+ "end": 97,
+ "range": [
+ 96,
+ 97
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 12
+ }
+ },
+ "start": 73,
+ "end": 83,
+ "range": [
+ 73,
+ 83
+ ],
+ "value": "block__element",
+ "selector": ".block__element"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/source.vue
new file mode 100644
index 00000000..917ef8c9
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector07-initial-ref/source.vue
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/ast.json
new file mode 100644
index 00000000..f0c4e8f3
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/ast.json
@@ -0,0 +1,352 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 12,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 132,
+ "range": [
+ 63,
+ 132
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 64,
+ "end": 131,
+ "range": [
+ 64,
+ 131
+ ],
+ "selectorText": ".foo",
+ "rawSelectorText": ".foo",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 71,
+ "end": 131,
+ "range": [
+ 71,
+ 131
+ ],
+ "selectorText": ".bar",
+ "rawSelectorText": ".bar",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "start": 80,
+ "end": 91,
+ "range": [
+ 80,
+ 91
+ ],
+ "property": "width",
+ "value": "10px",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 97,
+ "end": 131,
+ "range": [
+ 97,
+ 131
+ ],
+ "selectorText": "&,\n ../ .baz",
+ "rawSelectorText": "&,\n ../ .baz",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "start": 97,
+ "end": 98,
+ "range": [
+ 97,
+ 98
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 5
+ }
+ },
+ "start": 97,
+ "end": 98,
+ "range": [
+ 97,
+ 98
+ ],
+ "value": "&",
+ "selector": "&"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "start": 104,
+ "end": 112,
+ "range": [
+ 104,
+ 112
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 7
+ }
+ },
+ "start": 104,
+ "end": 107,
+ "range": [
+ 104,
+ 107
+ ],
+ "value": "../",
+ "selector": "../"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 7
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "start": 107,
+ "end": 108,
+ "range": [
+ 107,
+ 108
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "start": 108,
+ "end": 112,
+ "range": [
+ 108,
+ 112
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 6
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 119,
+ "end": 131,
+ "range": [
+ 119,
+ 131
+ ],
+ "property": "height",
+ "value": "10px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/selectors-text.json
new file mode 100644
index 00000000..a967bba2
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/selectors-text.json
@@ -0,0 +1,20 @@
+[
+ [
+ ".foo"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ],
+ [
+ ".foo",
+ " ",
+ ".bar"
+ ],
+ [
+ ".foo",
+ " ",
+ ".baz"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/selectors.json
new file mode 100644
index 00000000..7f77aa12
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/selectors.json
@@ -0,0 +1,220 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 71,
+ "end": 71,
+ "range": [
+ 71,
+ 71
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 71,
+ "end": 71,
+ "range": [
+ 71,
+ 71
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 71,
+ "end": 75,
+ "range": [
+ 71,
+ 75
+ ],
+ "value": "bar",
+ "selector": ".bar"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "foo",
+ "selector": ".foo"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 7
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "start": 107,
+ "end": 108,
+ "range": [
+ 107,
+ 108
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "start": 108,
+ "end": 112,
+ "range": [
+ 108,
+ 112
+ ],
+ "value": "baz",
+ "selector": ".baz"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/source.vue
new file mode 100644
index 00000000..f817c74d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector08-relative-ref/source.vue
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/ast.json b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/ast.json
new file mode 100644
index 00000000..92d31bb3
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/ast.json
@@ -0,0 +1,327 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 11,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 136,
+ "range": [
+ 63,
+ 136
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 14
+ }
+ },
+ "start": 64,
+ "end": 135,
+ "range": [
+ 64,
+ 135
+ ],
+ "selectorText": "textarea\n,input",
+ "rawSelectorText": "textarea\ninput",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 15
+ }
+ },
+ "start": 81,
+ "end": 94,
+ "range": [
+ 81,
+ 94
+ ],
+ "property": "color",
+ "value": "#A7A7A7",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 14
+ }
+ },
+ "start": 97,
+ "end": 135,
+ "range": [
+ 97,
+ 135
+ ],
+ "selectorText": "&:hover,\n /.is-hovered",
+ "rawSelectorText": "&:hover,\n /.is-hovered",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 97,
+ "end": 104,
+ "range": [
+ 97,
+ 104
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 3
+ }
+ },
+ "start": 97,
+ "end": 98,
+ "range": [
+ 97,
+ 98
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 3
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 98,
+ "end": 104,
+ "range": [
+ 98,
+ 104
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 108,
+ "end": 120,
+ "range": [
+ 108,
+ 120
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 3
+ }
+ },
+ "start": 108,
+ "end": 109,
+ "range": [
+ 108,
+ 109
+ ],
+ "value": "/",
+ "selector": "/"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 3
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 109,
+ "end": 120,
+ "range": [
+ 109,
+ 120
+ ],
+ "value": "is-hovered",
+ "selector": ".is-hovered"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 14
+ }
+ },
+ "start": 125,
+ "end": 135,
+ "range": [
+ 125,
+ 135
+ ],
+ "property": "color",
+ "value": "#000",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/selectors-text.json b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/selectors-text.json
new file mode 100644
index 00000000..46f107c3
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/selectors-text.json
@@ -0,0 +1,19 @@
+[
+ [
+ "textarea"
+ ],
+ [
+ "input"
+ ],
+ [
+ "textarea",
+ ":hover"
+ ],
+ [
+ "input",
+ ":hover"
+ ],
+ [
+ ".is-hovered"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/selectors.json b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/selectors.json
new file mode 100644
index 00000000..e5ddec01
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/selectors.json
@@ -0,0 +1,159 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 8
+ }
+ },
+ "start": 64,
+ "end": 72,
+ "range": [
+ 64,
+ 72
+ ],
+ "value": "textarea",
+ "selector": "textarea"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 3
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 98,
+ "end": 104,
+ "range": [
+ 98,
+ 104
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 0
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 73,
+ "end": 78,
+ "range": [
+ 73,
+ 78
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 3
+ },
+ "end": {
+ "line": 8,
+ "column": 9
+ }
+ },
+ "start": 98,
+ "end": 104,
+ "range": [
+ 98,
+ 104
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 3
+ },
+ "end": {
+ "line": 9,
+ "column": 14
+ }
+ },
+ "start": 109,
+ "end": 120,
+ "range": [
+ 109,
+ 120
+ ],
+ "value": "is-hovered",
+ "selector": ".is-hovered"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/source.vue b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/source.vue
new file mode 100644
index 00000000..44ff4a40
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus-selector09-root-ref/source.vue
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus01/ast.json b/tests/lib/styles/fixtures/index/stylus01/ast.json
new file mode 100644
index 00000000..6e785828
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus01/ast.json
@@ -0,0 +1,313 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 15,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 253,
+ "range": [
+ 63,
+ 253
+ ],
+ "nodes": [
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 26
+ }
+ },
+ "start": 64,
+ "end": 173,
+ "range": [
+ 64,
+ 173
+ ],
+ "name": "border-radius",
+ "identifier": "",
+ "paramsText": "()",
+ "rawParamsText": "()",
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 34
+ }
+ },
+ "start": 82,
+ "end": 114,
+ "range": [
+ 82,
+ 114
+ ],
+ "property": "-webkit-border-radius",
+ "value": "arguments",
+ "important": false
+ },
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 31
+ }
+ },
+ "start": 117,
+ "end": 146,
+ "range": [
+ 117,
+ 146
+ ],
+ "property": "-moz-border-radius",
+ "value": "arguments",
+ "important": false
+ },
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 26
+ }
+ },
+ "start": 149,
+ "end": 173,
+ "range": [
+ 149,
+ 173
+ ],
+ "property": "border-radius",
+ "value": "arguments",
+ "important": false
+ }
+ ]
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 41
+ }
+ },
+ "start": 175,
+ "end": 221,
+ "range": [
+ 175,
+ 221
+ ],
+ "selectorText": "body",
+ "rawSelectorText": "body",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 4
+ }
+ },
+ "start": 175,
+ "end": 179,
+ "range": [
+ 175,
+ 179
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 4
+ }
+ },
+ "start": 175,
+ "end": 179,
+ "range": [
+ 175,
+ 179
+ ],
+ "value": "body",
+ "selector": "body"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 2
+ },
+ "end": {
+ "line": 11,
+ "column": 41
+ }
+ },
+ "start": 182,
+ "end": 221,
+ "range": [
+ 182,
+ 221
+ ],
+ "property": "font",
+ "value": "12px Helvetica, Arial, sans-serif",
+ "important": false
+ }
+ ]
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "start": 223,
+ "end": 252,
+ "range": [
+ 223,
+ 252
+ ],
+ "selectorText": "a.button",
+ "rawSelectorText": "a.button",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 8
+ }
+ },
+ "start": 223,
+ "end": 231,
+ "range": [
+ 223,
+ 231
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 1
+ }
+ },
+ "start": 223,
+ "end": 224,
+ "range": [
+ 223,
+ 224
+ ],
+ "value": "a",
+ "selector": "a"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 1
+ },
+ "end": {
+ "line": 13,
+ "column": 8
+ }
+ },
+ "start": 224,
+ "end": 231,
+ "range": [
+ 224,
+ 231
+ ],
+ "value": "button",
+ "selector": ".button"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 2
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "start": 234,
+ "end": 252,
+ "range": [
+ 234,
+ 252
+ ],
+ "property": "border-radius",
+ "value": "5px",
+ "important": false
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus01/selectors-text.json b/tests/lib/styles/fixtures/index/stylus01/selectors-text.json
new file mode 100644
index 00000000..d2a6daa0
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus01/selectors-text.json
@@ -0,0 +1,9 @@
+[
+ [
+ "body"
+ ],
+ [
+ "a",
+ ".button"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus01/selectors.json b/tests/lib/styles/fixtures/index/stylus01/selectors.json
new file mode 100644
index 00000000..9e1ee89e
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus01/selectors.json
@@ -0,0 +1,69 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 0
+ },
+ "end": {
+ "line": 10,
+ "column": 4
+ }
+ },
+ "start": 175,
+ "end": 179,
+ "range": [
+ 175,
+ 179
+ ],
+ "value": "body",
+ "selector": "body"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 1
+ }
+ },
+ "start": 223,
+ "end": 224,
+ "range": [
+ 223,
+ 224
+ ],
+ "value": "a",
+ "selector": "a"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 1
+ },
+ "end": {
+ "line": 13,
+ "column": 8
+ }
+ },
+ "start": 224,
+ "end": 231,
+ "range": [
+ 224,
+ 231
+ ],
+ "value": "button",
+ "selector": ".button"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus01/source.vue b/tests/lib/styles/fixtures/index/stylus01/source.vue
new file mode 100644
index 00000000..e57bb179
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus01/source.vue
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus02/ast.json b/tests/lib/styles/fixtures/index/stylus02/ast.json
new file mode 100644
index 00000000..befcbbda
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus02/ast.json
@@ -0,0 +1,398 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 12,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 207,
+ "range": [
+ 63,
+ 207
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 11,
+ "column": 21
+ }
+ },
+ "start": 64,
+ "end": 206,
+ "range": [
+ 64,
+ 206
+ ],
+ "selectorText": "body",
+ "rawSelectorText": "body",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "body",
+ "selector": "body"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 44
+ }
+ },
+ "start": 71,
+ "end": 113,
+ "range": [
+ 71,
+ 113
+ ],
+ "property": "font",
+ "value": "14px/1.5 Helvetica, arial, sans-serif",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 11,
+ "column": 21
+ }
+ },
+ "start": 116,
+ "end": 206,
+ "range": [
+ 116,
+ 206
+ ],
+ "selectorText": "button\n ,button.button\n ,input[type='button']\n ,input[type='submit']",
+ "rawSelectorText": "button\n button.button\n input[type='button']\n input[type='submit']",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 116,
+ "end": 122,
+ "range": [
+ 116,
+ 122
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 116,
+ "end": 122,
+ "range": [
+ 116,
+ 122
+ ],
+ "value": "button",
+ "selector": "button"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 15
+ }
+ },
+ "start": 125,
+ "end": 138,
+ "range": [
+ 125,
+ 138
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 8
+ }
+ },
+ "start": 125,
+ "end": 131,
+ "range": [
+ 125,
+ 131
+ ],
+ "value": "button",
+ "selector": "button"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 15
+ }
+ },
+ "start": 131,
+ "end": 138,
+ "range": [
+ 131,
+ 138
+ ],
+ "value": "button",
+ "selector": ".button"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 22
+ }
+ },
+ "start": 141,
+ "end": 161,
+ "range": [
+ 141,
+ 161
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 7
+ }
+ },
+ "start": 141,
+ "end": 146,
+ "range": [
+ 141,
+ 146
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSAttributeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 7
+ },
+ "end": {
+ "line": 9,
+ "column": 22
+ }
+ },
+ "start": 146,
+ "end": 161,
+ "range": [
+ 146,
+ 161
+ ],
+ "attribute": "type",
+ "operator": "=",
+ "value": "button",
+ "quoteMark": "'",
+ "insensitiveFlag": null,
+ "selector": "[type='button']"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 22
+ }
+ },
+ "start": 164,
+ "end": 184,
+ "range": [
+ 164,
+ 184
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 7
+ }
+ },
+ "start": 164,
+ "end": 169,
+ "range": [
+ 164,
+ 169
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSAttributeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 7
+ },
+ "end": {
+ "line": 10,
+ "column": 22
+ }
+ },
+ "start": 169,
+ "end": 184,
+ "range": [
+ 169,
+ 184
+ ],
+ "attribute": "type",
+ "operator": "=",
+ "value": "submit",
+ "quoteMark": "'",
+ "insensitiveFlag": null,
+ "selector": "[type='submit']"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 21
+ }
+ },
+ "start": 189,
+ "end": 206,
+ "range": [
+ 189,
+ 206
+ ],
+ "property": "border-radius",
+ "value": "5px",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus02/selectors-text.json b/tests/lib/styles/fixtures/index/stylus02/selectors-text.json
new file mode 100644
index 00000000..ff8c2f31
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus02/selectors-text.json
@@ -0,0 +1,28 @@
+[
+ [
+ "body"
+ ],
+ [
+ "body",
+ " ",
+ "button"
+ ],
+ [
+ "body",
+ " ",
+ "button",
+ ".button"
+ ],
+ [
+ "body",
+ " ",
+ "input",
+ "[type='button']"
+ ],
+ [
+ "body",
+ " ",
+ "input",
+ "[type='submit']"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus02/selectors.json b/tests/lib/styles/fixtures/index/stylus02/selectors.json
new file mode 100644
index 00000000..3cfc5351
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus02/selectors.json
@@ -0,0 +1,356 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "body",
+ "selector": "body"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "body",
+ "selector": "body"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 2
+ }
+ },
+ "start": 116,
+ "end": 116,
+ "range": [
+ 116,
+ 116
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 2
+ },
+ "end": {
+ "line": 7,
+ "column": 8
+ }
+ },
+ "start": 116,
+ "end": 122,
+ "range": [
+ 116,
+ 122
+ ],
+ "value": "button",
+ "selector": "button"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "body",
+ "selector": "body"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 2
+ }
+ },
+ "start": 125,
+ "end": 125,
+ "range": [
+ 125,
+ 125
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 8
+ }
+ },
+ "start": 125,
+ "end": 131,
+ "range": [
+ 125,
+ 131
+ ],
+ "value": "button",
+ "selector": "button"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 8
+ },
+ "end": {
+ "line": 8,
+ "column": 15
+ }
+ },
+ "start": 131,
+ "end": 138,
+ "range": [
+ 131,
+ 138
+ ],
+ "value": "button",
+ "selector": ".button"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "body",
+ "selector": "body"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 2
+ }
+ },
+ "start": 141,
+ "end": 141,
+ "range": [
+ 141,
+ 141
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 7
+ }
+ },
+ "start": 141,
+ "end": 146,
+ "range": [
+ 141,
+ 146
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSAttributeSelector",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 7
+ },
+ "end": {
+ "line": 9,
+ "column": 22
+ }
+ },
+ "start": 146,
+ "end": 161,
+ "range": [
+ 146,
+ 161
+ ],
+ "attribute": "type",
+ "operator": "=",
+ "value": "button",
+ "quoteMark": "'",
+ "insensitiveFlag": null,
+ "selector": "[type='button']"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 4
+ }
+ },
+ "start": 64,
+ "end": 68,
+ "range": [
+ 64,
+ 68
+ ],
+ "value": "body",
+ "selector": "body"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 2
+ }
+ },
+ "start": 164,
+ "end": 164,
+ "range": [
+ 164,
+ 164
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 2
+ },
+ "end": {
+ "line": 10,
+ "column": 7
+ }
+ },
+ "start": 164,
+ "end": 169,
+ "range": [
+ 164,
+ 169
+ ],
+ "value": "input",
+ "selector": "input"
+ },
+ {
+ "type": "VCSSAttributeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 7
+ },
+ "end": {
+ "line": 10,
+ "column": 22
+ }
+ },
+ "start": 169,
+ "end": 184,
+ "range": [
+ 169,
+ 184
+ ],
+ "attribute": "type",
+ "operator": "=",
+ "value": "submit",
+ "quoteMark": "'",
+ "insensitiveFlag": null,
+ "selector": "[type='submit']"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus02/source.vue b/tests/lib/styles/fixtures/index/stylus02/source.vue
new file mode 100644
index 00000000..bb568433
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus02/source.vue
@@ -0,0 +1,12 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus03/ast.json b/tests/lib/styles/fixtures/index/stylus03/ast.json
new file mode 100644
index 00000000..fb64a896
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus03/ast.json
@@ -0,0 +1,527 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 14,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 188,
+ "range": [
+ 63,
+ 188
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 16
+ }
+ },
+ "start": 64,
+ "end": 187,
+ "range": [
+ 64,
+ 187
+ ],
+ "selectorText": "ul",
+ "rawSelectorText": "ul",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "ul",
+ "selector": "ul"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 13,
+ "column": 16
+ }
+ },
+ "start": 69,
+ "end": 187,
+ "range": [
+ 69,
+ 187
+ ],
+ "selectorText": "li a",
+ "rawSelectorText": "li a",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 69,
+ "end": 73,
+ "range": [
+ 69,
+ 73
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 69,
+ "end": 71,
+ "range": [
+ 69,
+ 71
+ ],
+ "value": "li",
+ "selector": "li"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 72,
+ "end": 73,
+ "range": [
+ 72,
+ 73
+ ],
+ "value": "a",
+ "selector": "a"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 18
+ }
+ },
+ "start": 78,
+ "end": 92,
+ "range": [
+ 78,
+ 92
+ ],
+ "property": "display",
+ "value": "block",
+ "important": false
+ },
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 15
+ }
+ },
+ "start": 97,
+ "end": 108,
+ "range": [
+ 97,
+ 108
+ ],
+ "property": "color",
+ "value": "blue",
+ "important": false
+ },
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 9,
+ "column": 16
+ }
+ },
+ "start": 113,
+ "end": 125,
+ "range": [
+ 113,
+ 125
+ ],
+ "property": "padding",
+ "value": "5px",
+ "important": false
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 130,
+ "end": 158,
+ "range": [
+ 130,
+ 158
+ ],
+ "selectorText": "html.ie &",
+ "rawSelectorText": "html.ie &",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 13
+ }
+ },
+ "start": 130,
+ "end": 139,
+ "range": [
+ 130,
+ 139
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "start": 130,
+ "end": 134,
+ "range": [
+ 130,
+ 134
+ ],
+ "value": "html",
+ "selector": "html"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 11
+ }
+ },
+ "start": 134,
+ "end": 137,
+ "range": [
+ 134,
+ 137
+ ],
+ "value": "ie",
+ "selector": ".ie"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "start": 137,
+ "end": 138,
+ "range": [
+ 137,
+ 138
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 12
+ },
+ "end": {
+ "line": 10,
+ "column": 13
+ }
+ },
+ "start": 138,
+ "end": 139,
+ "range": [
+ 138,
+ 139
+ ],
+ "value": "&",
+ "selector": "&"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 6
+ },
+ "end": {
+ "line": 11,
+ "column": 18
+ }
+ },
+ "start": 146,
+ "end": 158,
+ "range": [
+ 146,
+ 158
+ ],
+ "property": "padding",
+ "value": "6px",
+ "important": false
+ }
+ ]
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 13,
+ "column": 16
+ }
+ },
+ "start": 163,
+ "end": 187,
+ "range": [
+ 163,
+ 187
+ ],
+ "selectorText": "&:hover",
+ "rawSelectorText": "&:hover",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 11
+ }
+ },
+ "start": 163,
+ "end": 170,
+ "range": [
+ 163,
+ 170
+ ],
+ "nodes": [
+ {
+ "type": "VCSSNestingSelector",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 5
+ }
+ },
+ "start": 163,
+ "end": 164,
+ "range": [
+ 163,
+ 164
+ ],
+ "value": "&",
+ "selector": "&"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 5
+ },
+ "end": {
+ "line": 12,
+ "column": 11
+ }
+ },
+ "start": 164,
+ "end": 170,
+ "range": [
+ 164,
+ 170
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 6
+ },
+ "end": {
+ "line": 13,
+ "column": 16
+ }
+ },
+ "start": 177,
+ "end": 187,
+ "range": [
+ 177,
+ 187
+ ],
+ "property": "color",
+ "value": "red",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus03/selectors-text.json b/tests/lib/styles/fixtures/index/stylus03/selectors-text.json
new file mode 100644
index 00000000..ae1f1b0b
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus03/selectors-text.json
@@ -0,0 +1,30 @@
+[
+ [
+ "ul"
+ ],
+ [
+ "ul",
+ " ",
+ "li",
+ " ",
+ "a"
+ ],
+ [
+ "html",
+ ".ie",
+ " ",
+ "ul",
+ " ",
+ "li",
+ " ",
+ "a"
+ ],
+ [
+ "ul",
+ " ",
+ "li",
+ " ",
+ "a",
+ ":hover"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus03/selectors.json b/tests/lib/styles/fixtures/index/stylus03/selectors.json
new file mode 100644
index 00000000..c00e5307
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus03/selectors.json
@@ -0,0 +1,430 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "ul",
+ "selector": "ul"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "ul",
+ "selector": "ul"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 69,
+ "end": 69,
+ "range": [
+ 69,
+ 69
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 69,
+ "end": 71,
+ "range": [
+ 69,
+ 71
+ ],
+ "value": "li",
+ "selector": "li"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 72,
+ "end": 73,
+ "range": [
+ 72,
+ 73
+ ],
+ "value": "a",
+ "selector": "a"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 8
+ }
+ },
+ "start": 130,
+ "end": 134,
+ "range": [
+ 130,
+ 134
+ ],
+ "value": "html",
+ "selector": "html"
+ },
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 8
+ },
+ "end": {
+ "line": 10,
+ "column": 11
+ }
+ },
+ "start": 134,
+ "end": 137,
+ "range": [
+ 134,
+ 137
+ ],
+ "value": "ie",
+ "selector": ".ie"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 11
+ },
+ "end": {
+ "line": 10,
+ "column": 12
+ }
+ },
+ "start": 137,
+ "end": 138,
+ "range": [
+ 137,
+ 138
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "ul",
+ "selector": "ul"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 69,
+ "end": 69,
+ "range": [
+ 69,
+ 69
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 69,
+ "end": 71,
+ "range": [
+ 69,
+ 71
+ ],
+ "value": "li",
+ "selector": "li"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 72,
+ "end": 73,
+ "range": [
+ 72,
+ 73
+ ],
+ "value": "a",
+ "selector": "a"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "ul",
+ "selector": "ul"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 2
+ }
+ },
+ "start": 69,
+ "end": 69,
+ "range": [
+ 69,
+ 69
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 6,
+ "column": 4
+ }
+ },
+ "start": 69,
+ "end": 71,
+ "range": [
+ 69,
+ 71
+ ],
+ "value": "li",
+ "selector": "li"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 4
+ },
+ "end": {
+ "line": 6,
+ "column": 5
+ }
+ },
+ "start": 71,
+ "end": 72,
+ "range": [
+ 71,
+ 72
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 5
+ },
+ "end": {
+ "line": 6,
+ "column": 6
+ }
+ },
+ "start": 72,
+ "end": 73,
+ "range": [
+ 72,
+ 73
+ ],
+ "value": "a",
+ "selector": "a"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 5
+ },
+ "end": {
+ "line": 12,
+ "column": 11
+ }
+ },
+ "start": 164,
+ "end": 170,
+ "range": [
+ 164,
+ 170
+ ],
+ "value": ":hover",
+ "nodes": []
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus03/source.vue b/tests/lib/styles/fixtures/index/stylus03/source.vue
new file mode 100644
index 00000000..f8335023
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus03/source.vue
@@ -0,0 +1,14 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus04/ast.json b/tests/lib/styles/fixtures/index/stylus04/ast.json
new file mode 100644
index 00000000..f274ede7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus04/ast.json
@@ -0,0 +1,268 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 9,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 142,
+ "range": [
+ 63,
+ 142
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 24
+ }
+ },
+ "start": 64,
+ "end": 141,
+ "range": [
+ 64,
+ 141
+ ],
+ "selectorText": "table",
+ "rawSelectorText": "table",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "start": 64,
+ "end": 69,
+ "range": [
+ 64,
+ 69
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "start": 64,
+ "end": 69,
+ "range": [
+ 64,
+ 69
+ ],
+ "value": "table",
+ "selector": "table"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 6,
+ "column": 2
+ },
+ "end": {
+ "line": 8,
+ "column": 24
+ }
+ },
+ "start": 72,
+ "end": 141,
+ "range": [
+ 72,
+ 141
+ ],
+ "name": "for",
+ "identifier": "",
+ "paramsText": "row in 1 2 3 4 5",
+ "rawParamsText": "row in 1 2 3 4 5",
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 8,
+ "column": 24
+ }
+ },
+ "start": 97,
+ "end": 141,
+ "range": [
+ 97,
+ 141
+ ],
+ "selectorText": "tr:nth-child({row})",
+ "rawSelectorText": "tr:nth-child({row})",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "start": 97,
+ "end": 116,
+ "range": [
+ 97,
+ 116
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 97,
+ "end": 99,
+ "range": [
+ 97,
+ 99
+ ],
+ "value": "tr",
+ "selector": "tr"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 6
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "start": 99,
+ "end": 116,
+ "range": [
+ 99,
+ 116
+ ],
+ "value": ":nth-child",
+ "nodes": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 17
+ },
+ "end": {
+ "line": 7,
+ "column": 22
+ }
+ },
+ "start": 110,
+ "end": 115,
+ "range": [
+ 110,
+ 115
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 17
+ },
+ "end": {
+ "line": 7,
+ "column": 22
+ }
+ },
+ "start": 110,
+ "end": 115,
+ "range": [
+ 110,
+ 115
+ ],
+ "value": "{row}",
+ "selector": "{row}"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 6
+ },
+ "end": {
+ "line": 8,
+ "column": 24
+ }
+ },
+ "start": 123,
+ "end": 141,
+ "range": [
+ 123,
+ 141
+ ],
+ "property": "height",
+ "value": "10px * row",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus04/selectors-text.json b/tests/lib/styles/fixtures/index/stylus04/selectors-text.json
new file mode 100644
index 00000000..59a6037b
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus04/selectors-text.json
@@ -0,0 +1,11 @@
+[
+ [
+ "table"
+ ],
+ [
+ "table",
+ " ",
+ "tr",
+ ":nth-child({row})"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus04/selectors.json b/tests/lib/styles/fixtures/index/stylus04/selectors.json
new file mode 100644
index 00000000..bc9223c7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus04/selectors.json
@@ -0,0 +1,154 @@
+[
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "start": 64,
+ "end": 69,
+ "range": [
+ 64,
+ 69
+ ],
+ "value": "table",
+ "selector": "table"
+ }
+ ],
+ [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 5
+ }
+ },
+ "start": 64,
+ "end": 69,
+ "range": [
+ 64,
+ 69
+ ],
+ "value": "table",
+ "selector": "table"
+ },
+ {
+ "type": "VCSSSelectorCombinator",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 4
+ }
+ },
+ "start": 97,
+ "end": 97,
+ "range": [
+ 97,
+ 97
+ ],
+ "value": " ",
+ "selector": " "
+ },
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 4
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 97,
+ "end": 99,
+ "range": [
+ 97,
+ 99
+ ],
+ "value": "tr",
+ "selector": "tr"
+ },
+ {
+ "type": "VCSSSelectorPseudo",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 6
+ },
+ "end": {
+ "line": 7,
+ "column": 23
+ }
+ },
+ "start": 99,
+ "end": 116,
+ "range": [
+ 99,
+ 116
+ ],
+ "value": ":nth-child",
+ "nodes": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 17
+ },
+ "end": {
+ "line": 7,
+ "column": 22
+ }
+ },
+ "start": 110,
+ "end": 115,
+ "range": [
+ 110,
+ 115
+ ],
+ "nodes": [
+ {
+ "type": "VCSSTypeSelector",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 17
+ },
+ "end": {
+ "line": 7,
+ "column": 22
+ }
+ },
+ "start": 110,
+ "end": 115,
+ "range": [
+ 110,
+ 115
+ ],
+ "value": "{row}",
+ "selector": "{row}"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus04/source.vue b/tests/lib/styles/fixtures/index/stylus04/source.vue
new file mode 100644
index 00000000..2355b037
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus04/source.vue
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus05/ast.json b/tests/lib/styles/fixtures/index/stylus05/ast.json
new file mode 100644
index 00000000..2b4e76b8
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus05/ast.json
@@ -0,0 +1,278 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 15,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 277,
+ "range": [
+ 63,
+ 277
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 34
+ }
+ },
+ "start": 64,
+ "end": 98,
+ "range": [
+ 64,
+ 98
+ ],
+ "property": "vendors",
+ "value": "webkit moz o ms official",
+ "important": false
+ },
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 12,
+ "column": 40
+ }
+ },
+ "start": 100,
+ "end": 246,
+ "range": [
+ 100,
+ 246
+ ],
+ "name": "border-radius",
+ "identifier": "",
+ "paramsText": "()",
+ "rawParamsText": "()",
+ "nodes": [
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 2
+ },
+ "end": {
+ "line": 12,
+ "column": 40
+ }
+ },
+ "start": 118,
+ "end": 246,
+ "range": [
+ 118,
+ 246
+ ],
+ "name": "for",
+ "identifier": "",
+ "paramsText": "vendor in vendors",
+ "rawParamsText": "vendor in vendors",
+ "nodes": [
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 4
+ },
+ "end": {
+ "line": 10,
+ "column": 30
+ }
+ },
+ "start": 144,
+ "end": 196,
+ "range": [
+ 144,
+ 196
+ ],
+ "name": "if",
+ "identifier": "",
+ "paramsText": "vendor == official",
+ "rawParamsText": "vendor == official",
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 10,
+ "column": 6
+ },
+ "end": {
+ "line": 10,
+ "column": 30
+ }
+ },
+ "start": 172,
+ "end": 196,
+ "range": [
+ 172,
+ 196
+ ],
+ "property": "border-radius",
+ "value": "arguments",
+ "important": false
+ }
+ ]
+ },
+ {
+ "type": "VCSSAtRule",
+ "loc": {
+ "start": {
+ "line": 11,
+ "column": 4
+ },
+ "end": {
+ "line": 12,
+ "column": 40
+ }
+ },
+ "start": 201,
+ "end": 246,
+ "range": [
+ 201,
+ 246
+ ],
+ "name": "else",
+ "identifier": "",
+ "paramsText": "",
+ "rawParamsText": "",
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 12,
+ "column": 6
+ },
+ "end": {
+ "line": 12,
+ "column": 40
+ }
+ },
+ "start": 212,
+ "end": 246,
+ "range": [
+ 212,
+ 246
+ ],
+ "property": "-{vendor}-border-radius",
+ "value": "arguments",
+ "important": false
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "start": 247,
+ "end": 276,
+ "range": [
+ 247,
+ 276
+ ],
+ "selectorText": "#content",
+ "rawSelectorText": "#content",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 8
+ }
+ },
+ "start": 247,
+ "end": 255,
+ "range": [
+ 247,
+ 255
+ ],
+ "nodes": [
+ {
+ "type": "VCSSIDSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 8
+ }
+ },
+ "start": 247,
+ "end": 255,
+ "range": [
+ 247,
+ 255
+ ],
+ "value": "content",
+ "selector": "#content"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 14,
+ "column": 2
+ },
+ "end": {
+ "line": 14,
+ "column": 20
+ }
+ },
+ "start": 258,
+ "end": 276,
+ "range": [
+ 258,
+ 276
+ ],
+ "property": "border-radius",
+ "value": "5px",
+ "important": false
+ }
+ ]
+ }
+ ],
+ "comments": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus05/selectors-text.json b/tests/lib/styles/fixtures/index/stylus05/selectors-text.json
new file mode 100644
index 00000000..b3edf6bd
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus05/selectors-text.json
@@ -0,0 +1,5 @@
+[
+ [
+ "#content"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus05/selectors.json b/tests/lib/styles/fixtures/index/stylus05/selectors.json
new file mode 100644
index 00000000..71c0e492
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus05/selectors.json
@@ -0,0 +1,25 @@
+[
+ [
+ {
+ "type": "VCSSIDSelector",
+ "loc": {
+ "start": {
+ "line": 13,
+ "column": 0
+ },
+ "end": {
+ "line": 13,
+ "column": 8
+ }
+ },
+ "start": 247,
+ "end": 255,
+ "range": [
+ 247,
+ 255
+ ],
+ "value": "content",
+ "selector": "#content"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus05/source.vue b/tests/lib/styles/fixtures/index/stylus05/source.vue
new file mode 100644
index 00000000..6ed1d351
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus05/source.vue
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/index/stylus06/ast.json b/tests/lib/styles/fixtures/index/stylus06/ast.json
new file mode 100644
index 00000000..28bb4d3d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus06/ast.json
@@ -0,0 +1,175 @@
+{
+ "type": "VCSSStyleSheet",
+ "loc": {
+ "start": {
+ "line": 4,
+ "column": 28
+ },
+ "end": {
+ "line": 10,
+ "column": 0
+ }
+ },
+ "start": 63,
+ "end": 90,
+ "range": [
+ 63,
+ 90
+ ],
+ "nodes": [
+ {
+ "type": "VCSSStyleRule",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 9,
+ "column": 11
+ }
+ },
+ "start": 64,
+ "end": 89,
+ "range": [
+ 64,
+ 89
+ ],
+ "selectorText": ".a\n\n\n,.a",
+ "rawSelectorText": ".a\n\n/* */\n.a",
+ "selectors": [
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ]
+ },
+ {
+ "type": "VCSSSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 2
+ }
+ },
+ "start": 75,
+ "end": 77,
+ "range": [
+ 75,
+ 77
+ ],
+ "nodes": [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 2
+ }
+ },
+ "start": 75,
+ "end": 77,
+ "range": [
+ 75,
+ 77
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ]
+ }
+ ],
+ "nodes": [
+ {
+ "type": "VCSSDeclarationProperty",
+ "loc": {
+ "start": {
+ "line": 9,
+ "column": 2
+ },
+ "end": {
+ "line": 9,
+ "column": 11
+ }
+ },
+ "start": 80,
+ "end": 89,
+ "range": [
+ 80,
+ 89
+ ],
+ "property": "color",
+ "value": "red",
+ "important": false
+ }
+ ]
+ }
+ ],
+ "comments": [
+ {
+ "type": "VCSSComment",
+ "loc": {
+ "start": {
+ "line": 7,
+ "column": 0
+ },
+ "end": {
+ "line": 7,
+ "column": 6
+ }
+ },
+ "start": 68,
+ "end": 74,
+ "range": [
+ 68,
+ 74
+ ],
+ "text": " "
+ }
+ ],
+ "errors": []
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus06/selectors-text.json b/tests/lib/styles/fixtures/index/stylus06/selectors-text.json
new file mode 100644
index 00000000..72bb5b6d
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus06/selectors-text.json
@@ -0,0 +1,8 @@
+[
+ [
+ ".a"
+ ],
+ [
+ ".a"
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus06/selectors.json b/tests/lib/styles/fixtures/index/stylus06/selectors.json
new file mode 100644
index 00000000..d726f5f7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus06/selectors.json
@@ -0,0 +1,48 @@
+[
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 5,
+ "column": 0
+ },
+ "end": {
+ "line": 5,
+ "column": 2
+ }
+ },
+ "start": 64,
+ "end": 66,
+ "range": [
+ 64,
+ 66
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ],
+ [
+ {
+ "type": "VCSSClassSelector",
+ "loc": {
+ "start": {
+ "line": 8,
+ "column": 0
+ },
+ "end": {
+ "line": 8,
+ "column": 2
+ }
+ },
+ "start": 75,
+ "end": 77,
+ "range": [
+ 75,
+ 77
+ ],
+ "value": "a",
+ "selector": ".a"
+ }
+ ]
+]
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/index/stylus06/source.vue b/tests/lib/styles/fixtures/index/stylus06/source.vue
new file mode 100644
index 00000000..6c18f4f7
--- /dev/null
+++ b/tests/lib/styles/fixtures/index/stylus06/source.vue
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/tests/lib/styles/fixtures/selectors/query/stylus-interpolation01-selector/query-result.json b/tests/lib/styles/fixtures/selectors/query/stylus-interpolation01-selector/query-result.json
new file mode 100644
index 00000000..06211ecf
--- /dev/null
+++ b/tests/lib/styles/fixtures/selectors/query/stylus-interpolation01-selector/query-result.json
@@ -0,0 +1,5 @@
+{
+ ".emoji-{$name}": [
+ "div.emoji-foo"
+ ]
+}
\ No newline at end of file
diff --git a/tests/lib/styles/fixtures/selectors/query/stylus-interpolation01-selector/source.vue b/tests/lib/styles/fixtures/selectors/query/stylus-interpolation01-selector/source.vue
new file mode 100644
index 00000000..ff3e3cf6
--- /dev/null
+++ b/tests/lib/styles/fixtures/selectors/query/stylus-interpolation01-selector/source.vue
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/tests/lib/styles/parser/index.ts b/tests/lib/styles/parser/index.ts
index 1a88dc40..f41c4dad 100644
--- a/tests/lib/styles/parser/index.ts
+++ b/tests/lib/styles/parser/index.ts
@@ -9,6 +9,9 @@ import CSSStringifier from "postcss/lib/stringifier"
// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
// @ts-ignore
import SCSSStringifier from "postcss-scss/lib/scss-stringifier"
+// eslint-disable-next-line @mysticatea/ts/ban-ts-ignore
+// @ts-ignore
+import StylusStringifier from "postcss-styl/lib/stringifier"
import { getStyleFixtureResults, writeFixture } from "../test-utils"
import { VCSSNode, VCSSSelectorNode } from "../../../../lib/styles/ast"
@@ -34,6 +37,10 @@ const Stringifys = {
const stringifier = new CSSStringifier(builder)
stringify(node, stringifier)
},
+ stylus(node: any, builder: any) {
+ const stringifier = new StylusStringifier(builder)
+ stringify(node, stringifier)
+ },
}
/**
@@ -122,7 +129,7 @@ function checkCSSNodeLocations(
lang: string,
) {
if (node.node) {
- const rangeText = `${node.type}:\n${code.slice(...node.range)}`
+ let rangeText = `${node.type}:\n${code.slice(...node.range)}`
let postcssText = (node.node as any).toString((Stringifys as any)[lang])
if (node.type === "VCSSSelector" || node.type === "VCSSClassSelector") {
postcssText = postcssText.replace(
@@ -130,20 +137,25 @@ function checkCSSNodeLocations(
"",
)
postcssText = postcssText.replace(/^\s*\/\*([\s\S]*?)\*\/\s*/u, "")
- postcssText = postcssText.replace(/^\s*\/\/([^\n]*?)\n/u, "")
+ postcssText = postcssText.replace(/^\s*\/\/([^\n]*)\s*/u, "")
+ postcssText = postcssText.replace(/\s*\/\/([^\n]*)\s*$/u, "")
} else if (node.type === "VCSSSelectorCombinator") {
postcssText = postcssText.replace(
/\/\*(?![\s\S]*\*\/[\s\S]*\/\*)([\s\S]*?)\*\/\s*$/u,
"",
)
postcssText = postcssText.replace(/^\s*\/\*([\s\S]*?)\*\//u, "")
- postcssText = postcssText.replace(/\/\/([^\n]*?)\n\s*$/u, "")
+ postcssText = postcssText.replace(/\/\/([^\n]*)\s*$/u, "")
+ postcssText = postcssText.replace(/\s*\/\/([^\n]*)\s*$/u, "")
}
if (
node.type === "VCSSSelectorCombinator" &&
postcssText.trim() === ""
) {
// noop
+ } else if (node.type === "VCSSNestingSelector") {
+ rangeText = rangeText.trim()
+ postcssText = postcssText.trim()
} else if (node.type === "VCSSStyleSheet") {
// noop
} else {
@@ -163,7 +175,9 @@ function checkCSSNodeLocations(
text.slice(0, node.rawSelectorText.length),
node.rawSelectorText,
)
- assert.strictEqual(text[text.length - 1], "}")
+ if (lang !== "stylus") {
+ assert.strictEqual(text[text.length - 1], "}")
+ }
for (const n of node.selectors) {
checkCSSNodeLocations(code, n, lang)
}
@@ -176,10 +190,18 @@ function checkCSSNodeLocations(
}
} else if (node.type === "VCSSAtRule") {
const text = code.slice(...node.range)
- const expected = `@${node.name}`
+ const expected =
+ lang !== "stylus"
+ ? `@${node.name}`
+ : `${(node.node as any).raws.identifier ?? "@"}${node.name}`
assert.strictEqual(text.slice(0, expected.length), expected)
- const last = text[text.length - 1]
- assert.ok(last === "}" || last === ";", `act:${text[text.length - 1]}`)
+ if (lang !== "stylus") {
+ const last = text[text.length - 1]
+ assert.ok(
+ last === "}" || last === ";",
+ `act:${text[text.length - 1]}`,
+ )
+ }
} else if (node.type === "VCSSSelector") {
const { parent } = node
@@ -213,7 +235,6 @@ function checkCSSNodeLocations(
node.type === "VCSSTypeSelector" ||
node.type === "VCSSIDSelector" ||
node.type === "VCSSClassSelector" ||
- node.type === "VCSSNestingSelector" ||
node.type === "VCSSUniversalSelector" ||
node.type === "VCSSAttributeSelector" ||
node.type === "VCSSSelectorCombinator"
@@ -225,6 +246,9 @@ function checkCSSNodeLocations(
} else {
assert.strictEqual(text.trim(), node.selector.trim())
}
+ } else if (node.type === "VCSSNestingSelector") {
+ const text = code.slice(...node.range)
+ assert.strictEqual(text.trim(), node.selector.trim())
} else if (node.type === "VCSSSelectorPseudo") {
const text = code.slice(...node.range)
diff --git a/tsconfig.build.json b/tsconfig.build.json
index 08f33614..d782b5ce 100644
--- a/tsconfig.build.json
+++ b/tsconfig.build.json
@@ -1,4 +1,7 @@
{
"extends": "./tsconfig.json",
- "exclude": ["tests/**/*", "tools/**/*",]
+ "exclude": ["tests/**/*", "tools/**/*",],
+ "compilerOptions": {
+ "removeComments": true, /* Do not emit comments to output. */
+ }
}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 41a798f3..c350157f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -14,7 +14,7 @@
"outDir": "./dist", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
- "removeComments": true, /* Do not emit comments to output. */
+ // "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
diff --git a/typings/babel-eslint/index.d.ts b/typings/babel-eslint/index.d.ts
new file mode 100644
index 00000000..466254be
--- /dev/null
+++ b/typings/babel-eslint/index.d.ts
@@ -0,0 +1,8 @@
+import { Linter } from "eslint"
+
+declare module "babel-eslint" {
+ function parseForESLint(
+ text: string,
+ options?: any,
+ ): Linter.ESLintParseResult
+}
diff --git a/typings/postcss-styl/index.d.ts b/typings/postcss-styl/index.d.ts
new file mode 100644
index 00000000..caa045b6
--- /dev/null
+++ b/typings/postcss-styl/index.d.ts
@@ -0,0 +1,6 @@
+import postcss from "postcss"
+
+declare module "postcss-styl" {
+ const parse: postcss.Parser
+ const stringify: postcss.Stringifier
+}