File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
projects/common/src/color Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -31,4 +31,26 @@ describe('Color palette', () => {
3131 expect ( ( ) => new ColorPalette ( [ 'black' ] ) ) . toThrow ( ) ;
3232 expect ( ( ) => new ColorPalette ( [ 'white' , 'black' ] ) ) . not . toThrow ( ) ;
3333 } ) ;
34+
35+ test ( 'should return color combinations correctly' , ( ) => {
36+ const palette = new ColorPalette ( [ '#fffbeb' , '#140300' ] ) ;
37+ expect ( palette . getColorCombinations ( 2 ) ) . toEqual ( [
38+ {
39+ background : 'rgb(255, 251, 235)' ,
40+ foreground : '#080909' ,
41+ } ,
42+ {
43+ background : 'rgb(20, 3, 0)' ,
44+ foreground : '#FFFFFF' ,
45+ }
46+ ] ) ;
47+ } )
48+
49+ test ( 'should generate color for a string as expected from a limited set' , ( ) => {
50+ const palette = new ColorPalette ( [ '#fffbeb' , '#140300' , '#789ab7' ] ) ;
51+ expect ( palette . getColorCombinationForId ( 2 , 'test' ) ) . toEqual ( {
52+ background : 'rgb(255, 251, 235)' ,
53+ foreground : '#080909' ,
54+ } ) ;
55+ } )
3456} ) ;
You can’t perform that action at this time.
0 commit comments