Closed rstudner closed 8 years ago
if they're part of sprockets, they get transpiled.
Hrm. I'm having mixed results.
I have a file: AjaxSuccessFailureButton_spec.js.jsx in spec/javascripts/components
It isn't in the list of tests.
If I rename it to just .js (no jsx)
It shows up in the list of tests.
Thoughts?
Ah, sorry. You can read about it in the Teaspoon configuration, specifically the matcher
configuration directive.
I'm unsure why your spec would be a .jsx, but have at it. =)
Hah yeah.. just for React stuff, especially with multiple components, it just way easier to render them into the DOM/configure their props using the JSX syntax. The "pure js" React syntax is fine for doing really trivial things, but if you want to make a mock component (re: chunk of DOM) to use with a react widget (think "yield") it gets to be insane without JSX.
Sounds cool. I haven't had the opportunity to get into React yet. Hope you're sorted now though. =)
Yep, is working perfectly. I had the default matcher (as you suspected) and just forgot about that entire part of the Docs since it'd been so long since I'd had to get in there.
Thanks for the prompt responses and help -- much appreciated.
I'll try to update your docs (if you like) with a little subsection on 'setting up to test React' based on these little config tweaks etc.
Yeah man, feel free to create a wiki article for it -- would be super valuable to others I'm sure.
I was wondering if teaspoon could make sure of the various transpilers in the asset pipeline.. specifically, why I can't write:
myComponent_spec.js.jsx
and thus put JSX statements etc into my tests. Would make the testing of React components much much easier and since React is so popular, would give some more legs to the use cases teaspoon happily supports.
Thoughts?