Skip to content

Commit 4f5aacb

Browse files
committed
Add tests for props with component remount
1 parent a14ced5 commit 4f5aacb

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/tests/__snapshots__/functional.spec.jsx.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,15 @@ exports[`functional tests should update props and unmount 2`] = `
7575
color: yellow;
7676
}"
7777
`;
78+
79+
exports[`functional tests should use props on remount 1`] = `
80+
".button-1-id {
81+
color: black;
82+
}"
83+
`;
84+
85+
exports[`functional tests should use props on remount 2`] = `
86+
".button-1-id {
87+
color: red;
88+
}"
89+
`;

src/tests/functional.spec.jsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,21 @@ describe('functional tests', () => {
9393
assertSheet(sheet)
9494
wrapper.unmount()
9595
})
96+
97+
it('should use props on remount', () => {
98+
const Button = styled('button')({
99+
color: props => (props.primary ? 'red' : 'black')
100+
})
101+
102+
const wrapper = mount(<Button />)
103+
const sheet = styled.mountSheet()
104+
105+
assertSheet(sheet)
106+
wrapper
107+
.unmount()
108+
.mount()
109+
.setProps({primary: true})
110+
assertSheet(sheet)
111+
wrapper.unmount()
112+
})
96113
})

0 commit comments

Comments
 (0)