pzavolinsky / react-unit

Lightweight unit test library for ReactJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

possible to use `min-document` as minimal DOM?

ahdinosaur opened this issue Β· comments

commented

hey, this seems like a really awesome module and keen to use it in a React project, thanks! πŸ˜„

this isn't hugely important, i'm mostly just curious: would it be possible to use min-document as the minimal DOM implementation? that way this module can focus on the core features of unit testing with React instead of having to roll its own minimal DOM (and all the nuances of that endeavour).

Hi @ahdinosaur this certainly looks like a cool idea. I'll try it in the next few days.

The actual DOM mock code in react-unit is only about 10 lines of js, since most of the heavy-lifting is mapping the React shallow render representation into something that resembles a DOM.

In any case using a real DOM library like min-document will probably make Sizzle happier than an ad-hoc mock an thus catch currently unsupported/unknown selectors.

Thanks for pointing me in this direction, I'll add more feedback in this issue after having played with min-document for a bit.

Cheers.