Even with the karma test runner, testing in angularjs is painful. It's one thing to be able to write a angular.jscontroller, its another to be able to test them. Making it more difficult is the sheer complexity of the framework. There are different strategies of testing controllers, directives, filters and injectables (values, services, factories and providers)
There are two excellent articles about testing in angular.js by Year of Moo. Here and Here. However, my eyes start hurting when I look at the test code. It is modular, it is brilliantly thought out, it is very complete... but it is seriously hard to get my head around. An example of controller testing can be found here
It took me about a couple of days to summon up the courage to even attempt to read the code. Then I realised that the tests weren't doing that much at all. Most of it was boilerplate and not that interesting. Out of about 5 lines of test code, something interesting only happened in one of them. I abstracted out all the angular.js testing code into macros.
The point I've been making on previous post is that clojurescript rocks if we really embrace javascript libraries through macros. With macros for angular.js, working with angular.js is so much clearer than in javascript.
I have put together an example project that shows how one may go about doing a simple app with tests. I'm going to take a couple of posts to explain how purnam.angular, purnam.test andpurnam.test.angular work together.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/qbr4DRJp1SI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.