Coder Social home page Coder Social logo

Comments (4)

rtfeldman avatar rtfeldman commented on June 28, 2024

I'd be happy to accept a PR for it!

Looks like it'd need to use child_process.execFileSync and temp.openSync instead of temp.open.

from node-elm-compiler.

mockdeep avatar mockdeep commented on June 28, 2024

@rtfeldman Alright, I've PR'd the new helper, however it looks like my assumptions were wrong on what the result would be. I'm now successfully compiling my Elm to JS, but it looks like the Elm component doesn't get properly "rendered" using Jest and Enzyme. This might not be the best place to ask, but any advice on how to get a simple Elm app to render out its text? I've got a basic static component:

port module Welcome exposing (main)

import Html exposing (div, p, text)

main : Program Never (Never -> a) Never
main =
  Html.beginnerProgram { model = never, view = view, update = never }

view : never -> Html.Html msg
view never =
  div []
  [ p [] [ text "Welcome!!!" ]
  , p [] [ text "the bananas are over there" ]
  ]

And I'm using an updated version of react-elm-components. Against that component, I'm just expecting the text "Welcome!!!" to be in the rendered component.

from node-elm-compiler.

eeue56 avatar eeue56 commented on June 28, 2024

@mockdeep I don't quite follow the question, but if you're trying to do stuff with Html then you need to use elm-static-html-lib or elm-html-test.

from node-elm-compiler.

mockdeep avatar mockdeep commented on June 28, 2024

@eeue56 thanks for the information. To clarify a bit, I've mounted an Elm app inside of a React component, which works for me when I boot up my server and navigate to the page (I see the "Welcome!!!" text). However, I have tests written in JavaScript using the Jest testing framework and Enzyme for rendering the React components.

What I'm trying to accomplish is to have a way to gradually convert the React to Elm while minimally changing the tests. Adding this renderToStringSync compiler gets me a step closer, but it looks like there's still something that triggers Elm to render into the page when I visit it in the browser which doesn't get triggered in the tests. Not sure if it's the right direction, but one thought is maybe whether I could pluck the Elm app out of the components in the test and render it to static html using your elm-static-html-lib, but not too sure.

from node-elm-compiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.