Skip to content

Commit a1667b8

Browse files
committed
Add failing connect test
1 parent 6a51034 commit a1667b8

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/components/connect.spec.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,51 @@ describe('React', () => {
180180
expect(div.props.pass).toEqual('through');
181181
});
182182

183+
it('should remove undefined props', () => {
184+
const store = createStore(() => ({}));
185+
let props = {x: true};
186+
let container;
187+
188+
@connect(()=>({}), ()=>({}))
189+
class ConnectContainer extends Component {
190+
render() {
191+
return (
192+
<div {...this.props} />
193+
);
194+
}
195+
}
196+
197+
class HolderContainer extends Component {
198+
render() {
199+
return (
200+
<ConnectContainer {...props} />
201+
);
202+
}
203+
}
204+
205+
TestUtils.renderIntoDocument(
206+
<Provider store={store}>
207+
{() => (
208+
<HolderContainer ref={instance => container = instance} />
209+
)}
210+
</Provider>
211+
);
212+
213+
const propsBefore = {
214+
...TestUtils.findRenderedDOMComponentWithTag(container, 'div').props
215+
};
216+
217+
props = {};
218+
container.forceUpdate();
219+
220+
const propsAfter = {
221+
...TestUtils.findRenderedDOMComponentWithTag(container, 'div').props
222+
};
223+
224+
expect(propsBefore.x).toEqual(true);
225+
expect(propsAfter.x).toNotEqual(true);
226+
});
227+
183228
it('should ignore deep mutations in props', () => {
184229
const store = createStore(() => ({
185230
foo: 'bar'

0 commit comments

Comments
 (0)