cultureamp / react-elm-components

Write React components in Elm

Home Page:https://www.npmjs.com/package/react-elm-components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I get my Elm to render in mocha

EnriqueVidal opened this issue · comments

I know I can test Elm files with elm-test, but I'm also trying to run a small end to end test for my react file with the Elm component, the problem however is that the <Elm /> component in react-elm-components always renders an empty <div /> in mocha.

Any ideas on how to do an end to end test of a react component that's also rendering an Elm file?

Thanks in advance.

@EnriqueVidal Did you ever figure out a solution? I suspect it has something to do with the use of shouldComponentUpdate in index.js, but I don't know enough about React to be sure.

@ethagnawl I didn't and had to move on, so nowadays I separate my Elm and react into separate projects. I hadn't closed this in hopes that someone may have found a work around I will try again as soon as I can and either close this issue and post said workaround or update my findings.

@EnriqueVidal It seems like this isn't possible. As far as I can tell, the only way to achieve any sort of pre-rendering of an Elm application is to actually spin up a (headless) browser, wait for the page to load and the app to initialize (wait until an element/id present in your Elm app makes an appearance?), scrape the page and then dump the page's contents to a file.

Sorry for the long wait since it's a work week I haven been able to look into this yet, however my test suite runs on either HeadlessChrome or JSDOM I'd be happy if it were possible in any, will definitely try it. Thanks for the info.