Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inferno-test-utils] How to use this lib to change state or props, trigger change/input event/keydown event? #1540

Open
ReginaLiang opened this issue Mar 11, 2021 · 1 comment

Comments

@ReginaLiang
Copy link

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.

  1. How to get this rendered instance that I can get the global variables bound component?
  2. How can I change state/props in a test suite so that improving code coverage?
  3. How can I manually trigger input/change events in a test suite when I test the input element?

Look forward to your replying.
Thanks.

@Havunen
Copy link
Member

Havunen commented Mar 11, 2021

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__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants