Skip to content

Commit 9ca5779

Browse files
committed
Add some tests for getModifiedProps
1 parent f727018 commit 9ca5779

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/react-jsx-highcharts/test/utils/getModifiedProps.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,28 @@ describe('utils/getModifiedProps', () => {
5353
expect(returnedProps).toEqual(currProps);
5454

5555
});
56+
it('should not return text when children is not defined', () => {
57+
const prevProps = null;
58+
59+
const currProps = {
60+
a: 1
61+
};
62+
63+
const returnedProps = getModifiedProps(prevProps, currProps, true);
64+
expect(returnedProps.text).not.toBeDefined();
65+
expect(returnedProps.a).toBe(1);
66+
});
67+
68+
it('should return text when children changes', () => {
69+
const prevProps = {};
70+
71+
const currProps = {
72+
children: "teststring"
73+
};
74+
75+
const returnedProps = getModifiedProps(prevProps, currProps, true);
76+
expect(returnedProps.text).toBe("teststring");
77+
});
78+
5679
});
5780

0 commit comments

Comments
 (0)