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 was trying to use the shallow renderer to invoke a custom event handler with a string argument, eg. aliensLanded('thousand'). Tried this:
it('calls events with string event parameter',()=>{renderer.render(<ClickableComponent/>);expect(renderer,'with event','aliensLanded','thousand','to have rendered',<div><spanclassName="main-click">Main clicked 1000</span></div>);});
which did not work:
UnexpectedError:
Unknown assertion 'thousand', did you mean: 'on'
I understand telling the argument from the next assertion can be tricky if it's a string and the documentation clearly states that the argument has to be an object but custom "events" with non-object arguments are a real thing in my experience.
The text was updated successfully, but these errors were encountered:
Seems like using more than one argument is not supported either. How about adding <ReactElement> with event <string> <array> <assertion?> where array would be the arguments array of whatever types and not the first argument? For example:
it('calls events with string event parameter',()=>{renderer.render(<ClickableComponent/>);expect(renderer,'with event','aliensLanded',['thousand','the second argument'],'to have rendered',<div><spanclassName="main-click">Main clicked 1000</span></div>);});
would call aliensLanded('thousand', 'the second argument')
I was trying to use the shallow renderer to invoke a custom event handler with a string argument, eg.
aliensLanded('thousand')
. Tried this:which did not work:
I understand telling the argument from the next assertion can be tricky if it's a string and the documentation clearly states that the argument has to be an object but custom "events" with non-object arguments are a real thing in my experience.
The text was updated successfully, but these errors were encountered: