@@ -39,43 +39,66 @@ var color_convert = require('../lib/convert');
39
39
describe ( 'convert' , function ( ) {
40
40
describe ( '#rgb_to_lab()' , function ( ) {
41
41
it ( 'should convert to expected lab color #1' , function ( ) {
42
- assert . deepEqual ( { 'L' : 40.473 , 'a' : - 6.106 , 'b' : - 21.417 } ,
43
- round_all ( color_convert . rgb_to_lab ( { 'R' : 55 ,
44
- 'G' : 100 ,
45
- 'B' : 130 } ) ) ) ;
42
+ assert . deepStrictEqual ( { 'L' : 40.473 , 'a' : - 6.106 , 'b' : - 21.417 } ,
43
+ round_all ( color_convert . rgb_to_lab ( { 'R' : 55 ,
44
+ 'G' : 100 ,
45
+ 'B' : 130 } ) ) ) ;
46
46
} ) ;
47
47
it ( 'should convert to expected lab color #2' , function ( ) {
48
- assert . deepEqual ( { 'L' : 0 , 'a' : 0 , 'b' : 0 } ,
49
- round_all ( color_convert . rgb_to_lab ( { 'R' : 0 ,
50
- 'G' : 0 ,
51
- 'B' : 0 } ) ) ) ;
48
+ assert . deepStrictEqual ( { 'L' : 0 , 'a' : 0 , 'b' : 0 } ,
49
+ round_all ( color_convert . rgb_to_lab ( { 'R' : 0 ,
50
+ 'G' : 0 ,
51
+ 'B' : 0 } ) ) ) ;
52
52
} ) ;
53
53
it ( 'should convert to expected lab color #3' , function ( ) {
54
- assert . deepEqual ( { 'L' : 100 , 'a' : 0.005 , 'b' : - 0.010 } ,
55
- round_all ( color_convert . rgb_to_lab ( { 'R' : 255 ,
56
- 'G' : 255 ,
57
- 'B' : 255 } ) ) ) ;
54
+ assert . deepStrictEqual ( { 'L' : 100 , 'a' : 0.005 , 'b' : - 0.010 } ,
55
+ round_all ( color_convert . rgb_to_lab ( { 'R' : 255 ,
56
+ 'G' : 255 ,
57
+ 'B' : 255 } ) ) ) ;
58
58
} ) ;
59
59
it ( 'should convert to expected lab color #4' , function ( ) {
60
- assert . deepEqual ( { 'L' : 100 , 'a' : 0.005 , 'b' : - 0.010 } ,
61
- round_all ( color_convert . rgba_to_lab ( { 'R' : 255 ,
62
- 'G' : 255 ,
63
- 'B' : 255 ,
64
- 'A' : 1.0 } ) ) ) ;
60
+ assert . deepStrictEqual ( { 'L' : 100 , 'a' : 0.005 , 'b' : - 0.010 } ,
61
+ round_all ( color_convert . rgba_to_lab ( { 'R' : 255 ,
62
+ 'G' : 255 ,
63
+ 'B' : 255 ,
64
+ 'A' : 1.0 } ) ) ) ;
65
65
} ) ;
66
66
it ( 'should convert to expected lab color #5' , function ( ) {
67
- assert . deepEqual ( { 'L' : 100 , 'a' : 0.005 , 'b' : - 0.010 } ,
68
- round_all ( color_convert . rgba_to_lab ( { 'R' : 0 ,
69
- 'G' : 0 ,
70
- 'B' : 0 ,
71
- 'A' : 0.0 } ) ) ) ;
67
+ assert . deepStrictEqual ( { 'L' : 100 , 'a' : 0.005 , 'b' : - 0.010 } ,
68
+ round_all ( color_convert . rgba_to_lab ( { 'R' : 0 ,
69
+ 'G' : 0 ,
70
+ 'B' : 0 ,
71
+ 'A' : 0.0 } ) ) ) ;
72
72
} ) ;
73
73
it ( 'should convert to expected lab color #6' , function ( ) {
74
- assert . deepEqual ( { "L" : 53.389 , "a" : 0.003 , "b" : - 0.006 } ,
75
- round_all ( color_convert . rgba_to_lab ( { 'R' : 0 ,
76
- 'G' : 0 ,
77
- 'B' : 0 ,
78
- 'A' : 0.5 } ) ) ) ;
74
+ assert . deepStrictEqual ( { "L" : 53.389 , "a" : 0.003 , "b" : - 0.006 } ,
75
+ round_all ( color_convert . rgba_to_lab ( { 'R' : 0 ,
76
+ 'G' : 0 ,
77
+ 'B' : 0 ,
78
+ 'A' : 0.5 } ) ) ) ;
79
+ } ) ;
80
+ it ( 'should convert to expected lab color #6 from lowercase RGBA object' , function ( ) {
81
+ assert . deepStrictEqual ( { "L" : 53.389 , "a" : 0.003 , "b" : - 0.006 } ,
82
+ round_all ( color_convert . rgba_to_lab ( { 'r' : 0 ,
83
+ 'g' : 0 ,
84
+ 'b' : 0 ,
85
+ 'a' : 0.5 } ) ) ) ;
86
+ } ) ;
87
+ } )
88
+
89
+ describe ( '#normalize_rgb()' , function ( ) {
90
+ it ( 'should convert lowercase RGB props to uppercase' , function ( ) {
91
+ assert . deepStrictEqual ( { 'R' : 55 , 'G' : 255 , 'B' : 0 } ,
92
+ color_convert . normalize_rgb ( { 'r' : 55 ,
93
+ 'g' : 255 ,
94
+ 'b' : 0 } ) ) ;
95
+ } ) ;
96
+ it ( 'should convert lowercase RGBA props to uppercase' , function ( ) {
97
+ assert . deepStrictEqual ( { 'R' : 55 , 'G' : 255 , 'B' : 0 , 'A' : 0 } ,
98
+ color_convert . normalize_rgb ( { 'r' : 55 ,
99
+ 'g' : 255 ,
100
+ 'b' : 0 ,
101
+ 'a' : 0 } ) ) ;
79
102
} ) ;
80
103
} )
81
104
} ) ;
0 commit comments