@@ -389,6 +389,41 @@ var tests = [{
389
389
expected : [
390
390
{ type : 'function' , sourceIndex : 0 , value : 'url' , before : '' , after : '' , nodes : [ ] }
391
391
]
392
+ } , {
393
+ message : 'should parse comments' ,
394
+ fixture : '/*before*/ 1px /*between*/ 1px /*after*/' ,
395
+ expected : [
396
+ { type : 'comment' , sourceIndex : 0 , value : 'before' } ,
397
+ { type : 'space' , sourceIndex : 10 , value : ' ' } ,
398
+ { type : 'word' , sourceIndex : 11 , value : '1px' } ,
399
+ { type : 'space' , sourceIndex : 14 , value : ' ' } ,
400
+ { type : 'comment' , sourceIndex : 15 , value : 'between' } ,
401
+ { type : 'space' , sourceIndex : 26 , value : ' ' } ,
402
+ { type : 'word' , sourceIndex : 27 , value : '1px' } ,
403
+ { type : 'space' , sourceIndex : 30 , value : ' ' } ,
404
+ { type : 'comment' , sourceIndex : 31 , value : 'after' } ,
405
+ ]
406
+ } , {
407
+ message : 'should parse comments inside functions' ,
408
+ fixture : 'url( "/demo/bg.png" /*comment*/ )' ,
409
+ expected : [
410
+ { type : 'function' , sourceIndex : 0 , value : 'url' , before : ' ' , after : ' ' , nodes : [
411
+ { type : 'string' , sourceIndex : 5 , value : '/demo/bg.png' , quote :'"' } ,
412
+ { type : 'space' , sourceIndex : 19 , value : ' ' } ,
413
+ { type : 'comment' , sourceIndex : 20 , value : 'comment' }
414
+ ] }
415
+ ]
416
+ } , {
417
+ message : 'should parse unclosed comments' ,
418
+ fixture : '/*comment*/ 1px /* unclosed ' ,
419
+ expected : [
420
+ { type : 'comment' , sourceIndex : 0 , value : 'comment' } ,
421
+ { type : 'space' , sourceIndex : 11 , value : ' ' } ,
422
+ { type : 'word' , sourceIndex : 12 , value : '1px' } ,
423
+ { type : 'space' , sourceIndex : 15 , value : ' ' } ,
424
+ { type : 'comment' , sourceIndex : 16 , value : ' unclosed ' , unclosed :true }
425
+
426
+ ]
392
427
} ] ;
393
428
394
429
test ( 'Parse' , function ( t ) {
0 commit comments