inferno
inferno copied to clipboard
[inferno-test-utils] How to use this lib to change state or props, trigger change/input event/keydown event?
When I use inferno-test-utils
lib to test my inferno app, I encounter some problems that need your help.
Firstly I rendered a component use renderIntoContainer
.
But I have some problems blocks my work.
- How to get this
rendered instance
that I can get the global variables bound component? - How can I change
state/props
in a test suite so that improving code coverage? - How can I manually trigger
input/change
events in a test suite when I test theinput element
?
Look forward to your replying. Thanks.
Hi,
If you use renderIntoContainer
then you need to manually attach the container to DOM to make events work :(
The issue with renderIntoContainer
is that if inferno attaches it to the DOM then somebody would need to remove the container from the DOM or it leaks resources.
Maybe you could try to have a look at these tests for some idea how to write to your own:
https://github.com/infernojs/inferno/tree/master/packages/inferno-create-element/tests