You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to be able to search based on an id, and then be able to find component relative to the container in my first call to first:
importComponentfrom'src/components/Component'...it('configures component 1 with correct props',()=>{constcomponent=wrapper.first('#container-1').first(Component)expect(component.foo).toEqual('bar')})it('configures component 2 with correct props',()=>{constcomponent=wrapper.first('#container-2').first(Component)expect(component.foo).toEqual('baz')})
The first test will pass, however, the second test always fails with the reason that foo = bar
It looks like searching for a component using the component object is always done against the root component that was mounted rather than the wrapper that was returned by the first call to first
The text was updated successfully, but these errors were encountered:
That makes sense now that you've explained it. I was trying to avoid dereferencing the array as the number of child components is dynamic and therefore the index for the same child will be different from test to test, potentially causing confusion. But in the meantime this does get the job done. Thanks!
I have a component that renders multiple instances of a second component wrapped in divs:
I would expect to be able to search based on an id, and then be able to find
component
relative to the container in my first call tofirst
:The first test will pass, however, the second test always fails with the reason that
foo
=bar
It looks like searching for a component using the component object is always done against the root component that was mounted rather than the wrapper that was returned by the first call to
first
The text was updated successfully, but these errors were encountered: