Passed
Push — master ( a49ebc...60183c )
by Rafael
01:20
created

config_test.js ➔ ... ➔ it(ꞌcreates savable stateꞌ)   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 27
rs 8.8571
cc 1
nop 0
1
import { Config as ColorConfig } from '../../src/controls/color/js/config.js';
2
3
describe( 'default configurations', function() {
4
	it( 'overrides colors', function() {
5
		let output,
6
			colorConfig = new ColorConfig(),
7
			inputValues = {
8
				colors: [ 'red', 'white', 'blue' ],
9
				'neutral-color': 'yellow'
10
			};
11
12
		output = colorConfig.createSimpleConfig( inputValues );
13
14
		expect( output.palettes[0].colors ).toEqual( inputValues.colors );
15
	} );
16
17
	it( 'creates savable state', function() {
18
		let results,
19
			colorConfig = new ColorConfig(),
20
			controlState = {
21
				'active-palette': 'palette-primary',
22
				'active-palette-id': 'giberish',
23
				palettes: {
24
					'palette-primary': {
25
						colors: [ 'rgb(33, 150, 243)', 'rgb(13, 71, 161)', 'rgb(25, 118, 210)', 'rgb(66, 165, 245)', 'rgb(144,202,249)' ],
26
						format: 'palette-primary',
27
						'neutral-color': 'white'
28
					}
29
				},
30
				'saved_palettes': [
31
					{
32
						colors: [ 'rgb(252, 168, 157)', 'rgb(250, 199, 180)', 'rgb(153, 139, 130)', 'rgb(255,225,201)', 'rgb(175,199,185)' ],
33
						format: 'palette-primary',
34
						'neutral-color': '#FFE3CC'
35
					}
36
				]
37
			};
38
39
		results = colorConfig.createSavableState( controlState );
40
41
		expect( results.palettes.length ).toEqual( 7 );
42
		expect( results['saved_palettes'].length ).toEqual( 1 );
43
	} );
44
} );
45