@@ -22,33 +22,50 @@ beforeAll(() => {
2222
2323describe ( 'matchLineWhen' , ( ) => {
2424 it ( 'should match on px' , ( ) => {
25- expect ( matchLineWhen ( '12.5px' ) ) . toBeTruthy ( )
25+ const match = matchLineWhen ( '12.5px' )
26+ expect ( match ) . toBeTruthy ( )
27+ expect ( match ) . toEqual ( [ '12.5px' ] )
2628 } )
2729
2830 it ( 'should match on rem' , ( ) => {
29- expect ( matchLineWhen ( '12.5rem' ) ) . toBeTruthy ( )
31+ const match = matchLineWhen ( '12.5rem' )
32+ expect ( match ) . toBeTruthy ( )
33+ expect ( match ) . toEqual ( [ '12.5rem' ] )
34+ } )
35+
36+ it ( 'should match wtih leading zero' , ( ) => {
37+ const match = matchLineWhen ( '0.5rem' )
38+ expect ( match ) . toBeTruthy ( )
39+ expect ( match ) . toEqual ( [ '0.5rem' ] )
3040 } )
3141
3242 it ( 'should match on var' , ( ) => {
33- expect ( matchLineWhen ( 'var(--spacing-large)' ) ) . toBeTruthy ( )
43+ const match = matchLineWhen ( 'var(--spacing-large)' )
44+ expect ( match ) . toBeTruthy ( )
45+ expect ( match ) . toEqual ( [ 'var(--spacing-large)' ] )
3446 } )
3547
3648 it ( 'should not match on var only' , ( ) => {
37- expect ( matchLineWhen ( 'var' ) ) . toBeFalsy ( )
49+ const match = matchLineWhen ( 'var' )
50+ expect ( match ) . toBeFalsy ( )
3851 } )
3952
4053 it ( 'should not match on calc only' , ( ) => {
41- expect ( matchLineWhen ( 'calc' ) ) . toBeFalsy ( )
54+ const match = matchLineWhen ( 'calc' )
55+ expect ( match ) . toBeFalsy ( )
4256 } )
4357
4458 it ( 'should match on calc' , ( ) => {
45- expect (
46- matchLineWhen ( "margin-bottom: ${calc('small', 'large')};" )
47- ) . toBeTruthy ( )
59+ const match = matchLineWhen (
60+ "margin-bottom: ${calc('small', 'large')};"
61+ )
62+ expect ( match ) . toBeTruthy ( )
63+ expect ( match ) . toEqual ( [ "calc('small', 'large')" ] )
4864 } )
4965
5066 it ( 'should not match when no number was given' , ( ) => {
51- expect ( matchLineWhen ( 'document.body.removeListener' ) ) . toBeFalsy ( )
67+ const match = matchLineWhen ( 'document.body.removeListener' )
68+ expect ( match ) . toBeFalsy ( )
5269 } )
5370} )
5471
0 commit comments