File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff 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'
You can’t perform that action at this time.
0 commit comments