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

Elmish tutorial: mount test errors #31

Open
lederle opened this issue Feb 12, 2021 · 2 comments
Open

Elmish tutorial: mount test errors #31

lederle opened this issue Feb 12, 2021 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed starter technical

Comments

@lederle
Copy link

lederle commented Feb 12, 2021

I discovered some errors in the elmish.md walkthrough at the mount step. To be clear, when I run the tests for the final version of elmish.js as given in the repo, everything passes, so these errors are against an intermediate step in the text of elmish.md only.

  1. Entering the code as given through the mount implementation section produces the following:

Screenshot from 2021-02-11 19-48-05

This stems from the test call to elmish.mount. It looks as if the order of the arguments to view are in the wrong order; the instances specifically are: a) the call to view in the mount function within the elmish.md text and b) in the counter.js declaration of view. The arity of the call compared to the declaration also differs.

FWIW, to fix I switched the order of the args in counter.js (the final version of elmish.js seemed to indicate that was the way). This eliminates the TypeError for 'signal not a function', but running the tests leads to another error:

  1. The first test for the assert against the state of the counter fails, and the button seems not to be in the (js)DOM:

Screenshot from 2021-02-11 20-34-36

The view function returns a container, but it doesn't seem to be appended? When I call document.appendChild on each of the two calls to view in mount, the tests pass.

I am on Ubuntu 20.04, node 14.15.1.

@nelsonic nelsonic added bug Something isn't working help wanted Extra attention is needed starter technical labels Feb 12, 2021
@nelsonic
Copy link
Member

@lederle yeah, it appears to be a typo in the ordering rather than a defect.
Stoked you found it. Hope it didn't cause you too much grief. 👍

@nelsonic
Copy link
Member

nelsonic commented Aug 5, 2023

PR welcome to fix this. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed starter technical
Projects
None yet
Development

No branches or pull requests

2 participants