@@ -62,6 +62,13 @@ describe('pxtorem', function () {
62
62
63
63
expect ( processed ) . toBe ( expected ) ;
64
64
} ) ;
65
+
66
+ it ( 'should remain unitless if 0' , function ( ) {
67
+ var expected = '.rule { font-size: 0px; font-size: 0; }' ;
68
+ var processed = postcss ( pxtorem ( ) ) . process ( expected ) . css ;
69
+
70
+ expect ( processed ) . toBe ( expected ) ;
71
+ } ) ;
65
72
} ) ;
66
73
67
74
describe ( 'value parsing' , function ( ) {
@@ -193,7 +200,7 @@ describe('propWhiteList', function () {
193
200
var css = '.rule { font-size: 16px; margin: 16px; margin-left: 5px; padding: 5px; padding-right: 16px }' ;
194
201
var expected = '.rule { font-size: 1rem; margin: 1rem; margin-left: 5px; padding: 5px; padding-right: 1rem }' ;
195
202
var options = {
196
- propWhiteList : [ '~ font' , '^ margin' , '!margin-left' , '$ -right' , 'pad' ]
203
+ propWhiteList : [ '* font* ' , 'margin* ' , '!margin-left' , '* -right' , 'pad' ]
197
204
} ;
198
205
var processed = postcss ( pxtorem ( options ) ) . process ( css ) . css ;
199
206
@@ -204,7 +211,7 @@ describe('propWhiteList', function () {
204
211
var css = '.rule { font-size: 16px; margin: 16px; margin-left: 5px; padding: 5px; padding-right: 16px }' ;
205
212
var expected = '.rule { font-size: 16px; margin: 1rem; margin-left: 5px; padding: 5px; padding-right: 16px }' ;
206
213
var options = {
207
- propWhiteList : [ '*' , '!margin-left' , '!~ padding' , '!^ font' ]
214
+ propWhiteList : [ '*' , '!margin-left' , '!* padding* ' , '!font* ' ]
208
215
} ;
209
216
var processed = postcss ( pxtorem ( options ) ) . process ( css ) . css ;
210
217
@@ -321,50 +328,50 @@ describe('minPixelValue', function () {
321
328
322
329
describe ( 'filter-prop-list' , function ( ) {
323
330
it ( 'should find "exact" matches from propList' , function ( ) {
324
- var propList = [ 'font-size' , 'margin' , '!padding' , '~ border' , '*' , '$ y' , '!~ font' ] ;
331
+ var propList = [ 'font-size' , 'margin' , '!padding' , '* border* ' , '*' , '* y' , '!* font* ' ] ;
325
332
var expected = 'font-size,margin' ;
326
333
expect ( filterPropList . exact ( propList ) . join ( ) ) . toBe ( expected ) ;
327
334
} ) ;
328
335
329
336
it ( 'should find "contain" matches from propList and reduce to string' , function ( ) {
330
- var propList = [ 'font-size' , '~ margin' , '!padding' , '~ border' , '*' , '$ y' , '!~ font' ] ;
337
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , '* border* ' , '*' , '* y' , '!* font* ' ] ;
331
338
var expected = 'margin,border' ;
332
339
expect ( filterPropList . contain ( propList ) . join ( ) ) . toBe ( expected ) ;
333
340
} ) ;
334
341
335
342
it ( 'should find "start" matches from propList and reduce to string' , function ( ) {
336
- var propList = [ 'font-size' , '~ margin' , '!padding' , '^ border' , '*' , '$ y' , '!~ font' ] ;
343
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , 'border* ' , '*' , '* y' , '!* font* ' ] ;
337
344
var expected = 'border' ;
338
- expect ( filterPropList . start ( propList ) . join ( ) ) . toBe ( expected ) ;
345
+ expect ( filterPropList . startWith ( propList ) . join ( ) ) . toBe ( expected ) ;
339
346
} ) ;
340
347
341
348
it ( 'should find "end" matches from propList and reduce to string' , function ( ) {
342
- var propList = [ 'font-size' , '~ margin' , '!padding' , '^ border' , '*' , '$ y' , '!~ font' ] ;
349
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , 'border* ' , '*' , '* y' , '!* font* ' ] ;
343
350
var expected = 'y' ;
344
- expect ( filterPropList . end ( propList ) . join ( ) ) . toBe ( expected ) ;
351
+ expect ( filterPropList . endWith ( propList ) . join ( ) ) . toBe ( expected ) ;
345
352
} ) ;
346
353
347
354
it ( 'should find "not" matches from propList and reduce to string' , function ( ) {
348
- var propList = [ 'font-size' , '~ margin' , '!padding' , '^ border' , '*' , '$ y' , '!~ font' ] ;
355
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , 'border* ' , '*' , '* y' , '!* font* ' ] ;
349
356
var expected = 'padding' ;
350
- expect ( filterPropList . not ( propList ) . join ( ) ) . toBe ( expected ) ;
357
+ expect ( filterPropList . notExact ( propList ) . join ( ) ) . toBe ( expected ) ;
351
358
} ) ;
352
359
353
360
it ( 'should find "not contain" matches from propList and reduce to string' , function ( ) {
354
- var propList = [ 'font-size' , '~ margin' , '!padding' , '!^ border' , '*' , '$ y' , '!~ font' ] ;
361
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , '!border* ' , '*' , '* y' , '!* font* ' ] ;
355
362
var expected = 'font' ;
356
363
expect ( filterPropList . notContain ( propList ) . join ( ) ) . toBe ( expected ) ;
357
364
} ) ;
358
365
359
366
it ( 'should find "not start" matches from propList and reduce to string' , function ( ) {
360
- var propList = [ 'font-size' , '~ margin' , '!padding' , '!^ border' , '*' , '$ y' , '!~ font' ] ;
367
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , '!border* ' , '*' , '* y' , '!* font* ' ] ;
361
368
var expected = 'border' ;
362
- expect ( filterPropList . notStart ( propList ) . join ( ) ) . toBe ( expected ) ;
369
+ expect ( filterPropList . notStartWith ( propList ) . join ( ) ) . toBe ( expected ) ;
363
370
} ) ;
364
371
365
372
it ( 'should find "not end" matches from propList and reduce to string' , function ( ) {
366
- var propList = [ 'font-size' , '~ margin' , '!padding' , '!^ border' , '*' , '!$ y' , '!~ font' ] ;
373
+ var propList = [ 'font-size' , '* margin* ' , '!padding' , '!border* ' , '*' , '!* y' , '!* font* ' ] ;
367
374
var expected = 'y' ;
368
- expect ( filterPropList . notEnd ( propList ) . join ( ) ) . toBe ( expected ) ;
375
+ expect ( filterPropList . notEndWith ( propList ) . join ( ) ) . toBe ( expected ) ;
369
376
} ) ;
370
377
} ) ;
0 commit comments