@@ -35,6 +35,17 @@ describe('Parser → Function', () => {
3535 { type : 'word' , value : 'baz' }
3636 ]
3737 } ,
38+ // not ready yet - #30
39+ // {
40+ // it: 'should loosely parse url function with sub func',
41+ // test: 'url(var(foo))',
42+ // loose: true,
43+ // expected: [
44+ // { type: 'func', value: 'url' },
45+ // { type: 'paren', value: '(' },
46+ // { type: 'paren', value: ')' }
47+ // ]
48+ // },
3849 {
3950 it : 'should parse url function' ,
4051 test : 'url( /gfx/img/bg.jpg )' ,
@@ -70,6 +81,21 @@ describe('Parser → Function', () => {
7081 { type : 'paren' , value : ')' }
7182 ]
7283 } ,
84+ {
85+ it : 'should parse calc function with number and var #29' ,
86+ test : 'calc(-0.5 * var(foo))' ,
87+ expected : [
88+ { type : 'func' , value : 'calc' } ,
89+ { type : 'paren' , value : '(' } ,
90+ { type : 'number' , value : '-0.5' , unit : '' } ,
91+ { type : 'operator' , value : '*' } ,
92+ { type : 'func' , value : 'var' } ,
93+ { type : 'paren' , value : '(' } ,
94+ { type : 'word' , value : 'foo' } ,
95+ { type : 'paren' , value : ')' } ,
96+ { type : 'paren' , value : ')' }
97+ ]
98+ } ,
7399 {
74100 it : 'should parse calc function with nutty numbers' ,
75101 test : 'calc(1px + -2vw - 4px)' ,
@@ -140,7 +166,7 @@ describe('Parser → Function', () => {
140166
141167 fixtures . forEach ( ( fixture ) => {
142168 it ( fixture . it , ( ) => {
143- let ast = new Parser ( fixture . test ) . parse ( ) ,
169+ let ast = new Parser ( fixture . test , { loose : fixture . loose } ) . parse ( ) ,
144170 index = 0 ;
145171
146172 ast . first . walk ( ( node ) => {
0 commit comments