File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,13 @@ var scssContextParser = (function () {
147
147
end : lineNumberFor ( endIndex ) + 1
148
148
} ;
149
149
}
150
+ } else {
151
+ var codeStart = ctxCode . indexOf ( '{' ) ;
152
+ if ( codeStart > 0 ) {
153
+ context . type = 'css' ;
154
+ context . name = ctxCode . slice ( 0 , codeStart ) . trim ( ) ;
155
+ context . value = extractCode ( ctxCode , codeStart ) . trim ( ) ;
156
+ }
150
157
}
151
158
152
159
return context ;
Original file line number Diff line number Diff line change
1
+ .foo {
2
+ font-weight : bold ;
3
+ color : red ;
4
+ .bar {
5
+ color : blue ;
6
+ }
7
+ }
Original file line number Diff line number Diff line change @@ -137,6 +137,17 @@ describe('ScssCommentParser', function () {
137
137
} ) ;
138
138
} ) ;
139
139
140
+ describe ( 'css rule' , function ( ) {
141
+ it ( 'should detect it' , function ( ) {
142
+ var context = parser . contextParser ( getContent ( 'rule.test.scss' ) ) ;
143
+ assert . deepEqual ( context , {
144
+ type : 'css' ,
145
+ name : '.foo' ,
146
+ value : 'font-weight: bold;\n color: red;\n .bar {\n color: blue;\n }'
147
+ } ) ;
148
+ } ) ;
149
+ } ) ;
150
+
140
151
describe ( 'unknown' , function ( ) {
141
152
it ( 'should assing unknown' , function ( ) {
142
153
var context = parser . contextParser ( getContent ( 'unknown.test.scss' ) ) ;
@@ -209,4 +220,4 @@ describe('ScssCommentParser', function () {
209
220
assert . equal ( parser . extractCode ( '{{ /* }} */ }}' ) , '{ /* }} */ }' ) ;
210
221
} ) ;
211
222
} ) ;
212
- } ) ;
223
+ } ) ;
You can’t perform that action at this time.
0 commit comments