why does the inferno-test-utils require the DOM as the second param? #1363
Comments
|
|
So where do I get the DOM? why need the DOM? isn't there an option similar to react-test-renderer that does not require the dom as the parameter. You just give it the component and that's it. |
|
@aprilmintacpineda Something like this could work let container;
beforeEach(() => {
container = document.createElement('div');
document.body.appendChild(container); // This is needed for synthetic events fe. clicks
});
afterEach(() => {
render(null, container); // Tear down, to remove events
document.body.removeChild(container);
});
describe('', () => {
it('your test', () => {});
});
|
|
That's going to require mocking the |
|
Basically, what I want to do, is I want to be able to do this with inferno-js https://github.com/aprilmintacpineda/react-context-api-store/blob/master/__tests__/provider.spec.js Notice that I did not have to mock anything about the DOM. All I needed to do was call |
|
Inferno is made DOM in mind. There are no plans to build Inferno native. You need jsDOM If you want to run tests in Node |
|
Somebody could build custom renderer that fakes out native DOM APIs providing some simple objects |
|
@sprlwrksAprilmintacpineda If you want simple out of the box testing for your components you could use Support for V6 will be coming shortly hopefully |
|
The second parameter of render is used to target rendering. It could be Html Node, element, or similar fake JS object (jsDOM?) |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

I think it should be removed since it should automatically know to use
inferno-dom(which I tried using but I got an error saying it's deprecated) or whatever.The docs should really be improved.
The text was updated successfully, but these errors were encountered: