Skip to content

Commit 37ad1d3

Browse files
committed
Fix fill color reducer test
1 parent 8186781 commit 37ad1d3

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test/unit/fill-color-reducer.test.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-env jest */
2-
import fillColorReducer from '../../src/reducers/fill-color';
3-
import {changeFillColor} from '../../src/reducers/fill-color';
2+
import fillColorReducer from '../../src/reducers/fill-style';
3+
import {changeFillColor} from '../../src/reducers/fill-style';
44
import {setSelectedItems} from '../../src/reducers/selected-items';
55
import {MIXED} from '../../src/helper/style-path';
6+
import GradientTypes from '../../src/lib/gradient-types';
67
import {mockPaperRootItem} from '../__mocks__/paperMocks';
78

89
test('initialState', () => {
@@ -16,16 +17,16 @@ test('changeFillColor', () => {
1617

1718
// 3 value hex code
1819
let newFillColor = '#fff';
19-
expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */))
20+
expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */).primary)
2021
.toEqual(newFillColor);
21-
expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */))
22+
expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */).primary)
2223
.toEqual(newFillColor);
2324

2425
// 6 value hex code
2526
newFillColor = '#facade';
26-
expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */))
27+
expect(fillColorReducer(defaultState /* state */, changeFillColor(newFillColor) /* action */).primary)
2728
.toEqual(newFillColor);
28-
expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */))
29+
expect(fillColorReducer('#010' /* state */, changeFillColor(newFillColor) /* action */).primary)
2930
.toEqual(newFillColor);
3031
});
3132

@@ -35,18 +36,18 @@ test('changefillColorViaSelectedItems', () => {
3536
const fillColor1 = 6;
3637
const fillColor2 = null; // transparent
3738
let selectedItems = [mockPaperRootItem({fillColor: fillColor1})];
38-
expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */))
39+
expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */).primary)
3940
.toEqual(fillColor1);
4041
selectedItems = [mockPaperRootItem({fillColor: fillColor2})];
41-
expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */))
42+
expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */).primary)
4243
.toEqual(fillColor2);
4344
selectedItems = [mockPaperRootItem({fillColor: fillColor1}), mockPaperRootItem({fillColor: fillColor2})];
44-
expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */))
45+
expect(fillColorReducer(defaultState /* state */, setSelectedItems(selectedItems) /* action */).primary)
4546
.toEqual(MIXED);
4647
});
4748

4849
test('invalidChangeFillColor', () => {
49-
const origState = '#fff';
50+
const origState = {primary: '#fff', secondary: null, gradientType: GradientTypes.SOLID};
5051

5152
expect(fillColorReducer(origState /* state */, changeFillColor() /* action */))
5253
.toBe(origState);

0 commit comments

Comments
 (0)