Hi Arnaud,

I feel your pain. I've been developing with cljs nearly from the beginning 
(though as a newbie to Clojure) and the road has been bumpy but plenty 
rewarding. My advice is to stay at it; your flow will improve and the language 
and tooling have been improving a lot, too.

I'll speak to a couple points about testing. I'm far from a veteran but with a 
couple apps undergoing heavy refactoring I've felt the pain of components 
breaking b/c of subtle changes to data structures, so I've been exploring this 
a bit.

In terms of testing, I am using React.addons.TestUtils.Simulate (I use 
react-with-addons.js in development, which includes it), and it is vital for 
being able to test components, because JavaScript event handlers like 
'onChange' aren't triggered programmatically. Also I should note I'm using 
reagent, allowing me to be explicit about passing references to state in as a 
parameter(s), which makes mocking simple. Finally I've made a component 
mounting macro that just creates and tears down a DOM node target just for the 
test. The result of this is that I can pass a certain state in to a component, 
simulate some clicks, input, or external state change, and then inspect the 
resulting state in the test. I am using simple (assert ...)'s and run my tests 
in a separate tests.html (which refreshes on every compilation via 
ring-refresh). Failing asserts point right to the failure in devtools with 
sourcemaps enabled and change the favicon for a quick visual indicator w/o 
having to switch tabs.

So like I said, keep at it and I'm sure you'll find your flow. A lot is already 
possible.
M

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to