-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
I expected this to pass:
it('calls events with currentTarget', () => {
const EventTargetComponent = () => {
const [value, setValue] = useState();
const handleChange = (event) => setValue(event.currentTarget.value);
return <div><input onChange={handleChange} value="before-change"/><span>{value}</span></div>;
}
expect(<EventTargetComponent/>, 'when deeply rendered', 'with event',
'change', { currentTarget: {value: 'test'} }, 'on', <input/>, 'to have rendered',
<div>
<input/>
<span>test</span>
</div>);
});But it failed with this:
2) unexpected-react (deep rendering) with events calls events with currentTarget:
UnexpectedError:
expected <EventTargetComponent />
when deeply rendered with event 'change', { currentTarget: { value: 'test' } } on <input /> to have rendered <div><input /><span>test</span></div>
<EventTargetComponent>
<div>
<input onChange={function handleChange(event) { /* ... */ }} value="before-change" />
<span>
before-change // before-change
// test
</span>
</div>
Does this maybe mean the deep renderer does not allow triggering events with arbitrary properties? The documentation suggests that it should be possible..
Metadata
Metadata
Assignees
Labels
No labels