@@ -15,7 +15,7 @@ describe('Test `normalizeColor` function', () => {
1515 'rgb(1, 2, 3,)' ,
1616 'rgb(1, 2, 3' ,
1717 ] . forEach ( ( color ) => {
18- expect ( normalizeColor ( color ) ) . toBe ( null ) ;
18+ expect ( normalizeColor ( color ) ) . toBeUndefined ( ) ;
1919 } ) ;
2020 } ) ;
2121
@@ -33,7 +33,7 @@ describe('Test `normalizeColor` function', () => {
3333 'hsl(1%, 2, 3)' ,
3434 'rg b( 1%, 2%, 3%)' ,
3535 ] . forEach ( ( color ) => {
36- expect ( normalizeColor ( color ) ) . toBe ( null ) ;
36+ expect ( normalizeColor ( color ) ) . toBeUndefined ( ) ;
3737 } ) ;
3838 } ) ;
3939
@@ -50,7 +50,7 @@ describe('Test `normalizeColor` function', () => {
5050 'rgb(-1, -2, -3)' ,
5151 'rgba(0, 0, 0, 1)' ,
5252 ] . forEach ( ( color ) => {
53- expect ( normalizeColor ( color ) ) . not . toBe ( null ) ;
53+ expect ( normalizeColor ( color ) ) . toBeDefined ( ) ;
5454 } ) ;
5555 } ) ;
5656 } ) ;
@@ -65,36 +65,36 @@ describe('Test `normalizeColor` function', () => {
6565 [ 0x123456 , 0x123456 ] ,
6666 [ 0x1234567 , 0x1234567 ] ,
6767 [ 0x12345678 , 0x12345678 ] ,
68- [ 0x123456789 , null ] ,
68+ [ 0x123456789 , undefined ] ,
6969 [ 11 , 11 ] ,
7070 [ 158 , 158 ] ,
71- [ 300.78 , null ] ,
72- [ - 300 , null ] ,
71+ [ 300.78 , undefined ] ,
72+ [ - 300 , undefined ] ,
7373 [ 0 , 0 ] ,
74- [ NaN , null ] ,
75- [ Infinity , null ] ,
76- [ - Infinity , null ] ,
74+ [ NaN , undefined ] ,
75+ [ Infinity , undefined ] ,
76+ [ - Infinity , undefined ] ,
7777 ] ) ( 'normalizeColor(%d) = %p' , ( color , expectedColor ) => {
7878 expect ( normalizeColor ( color ) ) . toBe ( expectedColor ) ;
7979 } ) ;
8080 } ) ;
8181
8282 describe ( 'Test colors being a number as string' , ( ) => {
8383 test . each ( [
84- [ '0x1' , null ] ,
85- [ '0x12' , null ] ,
86- [ '0x123' , null ] ,
87- [ '0x1234' , null ] ,
88- [ '0x12345' , null ] ,
89- [ '0x123456' , null ] ,
90- [ '0x1234567' , null ] ,
91- [ '0x12345678' , null ] ,
92- [ '0x123456789' , null ] ,
93- [ '11' , null ] ,
94- [ '158' , null ] ,
95- [ '300.78' , null ] ,
96- [ '-300' , null ] ,
97- [ '0' , null ] ,
84+ [ '0x1' , undefined ] ,
85+ [ '0x12' , undefined ] ,
86+ [ '0x123' , undefined ] ,
87+ [ '0x1234' , undefined ] ,
88+ [ '0x12345' , undefined ] ,
89+ [ '0x123456' , undefined ] ,
90+ [ '0x1234567' , undefined ] ,
91+ [ '0x12345678' , undefined ] ,
92+ [ '0x123456789' , undefined ] ,
93+ [ '11' , undefined ] ,
94+ [ '158' , undefined ] ,
95+ [ '300.78' , undefined ] ,
96+ [ '-300' , undefined ] ,
97+ [ '0' , undefined ] ,
9898 ] ) ( 'normalizeColor("%s") = %p' , ( color , expectedColor ) => {
9999 expect ( normalizeColor ( color ) ) . toBe ( expectedColor ) ;
100100 } ) ;
@@ -160,26 +160,26 @@ describe('Test `normalizeColor` function', () => {
160160
161161 describe ( 'Test invalid hex' , ( ) => {
162162 test . each ( [
163- [ '#12345' , null ] ,
164- [ '#12345g' , null ] ,
165- [ '#1234567' , null ] ,
166- [ '#abcde' , null ] ,
167- [ '#abcdeff' , null ] ,
168- [ '#abcde' , null ] ,
169- [ '#abcdeff' , null ] ,
170- [ '#abcde' , null ] ,
171- [ '#abcdeff' , null ] ,
163+ [ '#12345' , undefined ] ,
164+ [ '#12345g' , undefined ] ,
165+ [ '#1234567' , undefined ] ,
166+ [ '#abcde' , undefined ] ,
167+ [ '#abcdeff' , undefined ] ,
168+ [ '#abcde' , undefined ] ,
169+ [ '#abcdeff' , undefined ] ,
170+ [ '#abcde' , undefined ] ,
171+ [ '#abcdeff' , undefined ] ,
172172 ] ) ( 'normalizeColor(%s) = %p' , ( color , expectedColor ) => {
173173 expect ( normalizeColor ( color ) ) . toBe ( expectedColor ) ;
174174 } ) ;
175175 } ) ;
176176 } ) ;
177177 describe ( 'Test colors being a rgb string' , ( ) => {
178178 test . each ( [
179- [ 'rgb (0,0,0)' , null ] ,
180- [ 'rgb(50,200,150, 45)' , null ] ,
181- [ 'RGB(50,200,150)' , null ] ,
182- [ 'rgb(50,200,150, 0.45)' , null ] ,
179+ [ 'rgb (0,0,0)' , undefined ] ,
180+ [ 'rgb(50,200,150, 45)' , undefined ] ,
181+ [ 'RGB(50,200,150)' , undefined ] ,
182+ [ 'rgb(50,200,150, 0.45)' , undefined ] ,
183183 [ 'rgb(0, 0, 255)' , 0x0000ffff ] ,
184184 [ 'rgb(0 0 255)' , 0x0000ffff ] ,
185185 [ 'rgb(100, 15, 69)' , 0x640f45ff ] ,
@@ -205,8 +205,8 @@ describe('Test `normalizeColor` function', () => {
205205
206206 describe ( 'Test colors being a rgba string' , ( ) => {
207207 test . each ( [
208- [ 'RGBA(100 ,255 ,50 ,50 )' , null ] ,
209- [ 'rgba (100,255,50,.5)' , null ] ,
208+ [ 'RGBA(100 ,255 ,50 ,50 )' , undefined ] ,
209+ [ 'rgba (100,255,50,.5)' , undefined ] ,
210210 [ 'rgba(0, 0, 0, .5)' , 0x00000080 ] ,
211211 [ 'rgba(0, 0, 0, 0.0)' , 0x00000000 ] ,
212212 [ 'rgba(0, 0, 0, 0)' , 0x00000000 ] ,
@@ -232,10 +232,10 @@ describe('Test `normalizeColor` function', () => {
232232
233233 describe ( 'Test colors being a hsl string' , ( ) => {
234234 test . each ( [
235- [ 'HSL(0,100%,50%)' , null ] ,
236- [ 'hsl(120 ,0.99, 0.1 )' , null ] ,
237- [ 'hsl(0,100,50)' , null ] ,
238- [ 'hsl(0,100%,50%, 0.5)' , null ] ,
235+ [ 'HSL(0,100%,50%)' , undefined ] ,
236+ [ 'hsl(120 ,0.99, 0.1 )' , undefined ] ,
237+ [ 'hsl(0,100,50)' , undefined ] ,
238+ [ 'hsl(0,100%,50%, 0.5)' , undefined ] ,
239239 [ 'hsl(0, 0%, 0%)' , 0x000000ff ] ,
240240 [ 'hsl(360, 100%, 100%)' , 0xffffffff ] ,
241241 [ 'hsl(180, 50%, 50%)' , 0x40bfbfff ] ,
@@ -271,7 +271,7 @@ describe('Test `normalizeColor` function', () => {
271271 [ 'hsla(360 100% 100% / 1)' , 0xffffffff ] ,
272272 [ 'hsla(360 100% 100% / 0)' , 0xffffff00 ] ,
273273 [ 'hsla(180 50% 50% / 0.2)' , 0x40bfbf33 ] ,
274- [ 'HSLA(0,100%,50%,0.5)' , null ] ,
274+ [ 'HSLA(0,100%,50%,0.5)' , undefined ] ,
275275 [ 'hsla(0,100%,50%,0.5)' , 0xff000080 ] ,
276276 [ 'hsla(120,100%,50%, 0.5)' , 0x00ff0080 ] ,
277277 [ 'hsla(120,100%,50%, 1)' , 0x00ff00ff ] ,
@@ -292,7 +292,7 @@ describe('Test `normalizeColor` function', () => {
292292 [ 'hwb(360, 100%, 100%)' , 0x808080ff ] ,
293293 [ 'hwb(0 0% 0%)' , 0xff0000ff ] ,
294294 [ 'hwb(70 50% 0%)' , 0xeaff80ff ] ,
295- [ 'HWB(0,100%,50%)' , null ] ,
295+ [ 'HWB(0,100%,50%)' , undefined ] ,
296296 [ 'hwb(0,67%, 33%)' , 0xabababff ] ,
297297 [ 'hwb(0,67% , 33%)' , 0xabababff ] ,
298298 [ 'hwb(48, 38%, 6%)' , 0xf0d361ff ] ,
@@ -304,10 +304,10 @@ describe('Test `normalizeColor` function', () => {
304304 describe ( 'Test colors a colorName string' , ( ) => {
305305 test . each ( [
306306 [ 'red' , 0xff0000ff ] ,
307- [ 'transparent' , undefined ] , // Transparent cannot be represented as a number
307+ [ 'transparent' , null ] , // Transparent cannot be represented as a number
308308 [ 'peachpuff' , 0xffdab9ff ] ,
309- [ 'peachPuff' , null ] ,
310- [ 'PeachPuff' , null ] ,
309+ [ 'peachPuff' , undefined ] ,
310+ [ 'PeachPuff' , undefined ] ,
311311 ] ) ( 'normalizeColor(%s) = %p' , ( color , expectedColor ) => {
312312 expect ( normalizeColor ( color ) ) . toBe ( expectedColor ) ;
313313 } ) ;
0 commit comments