GulinSS / jade-angularjs-brunch

Automatic compiler Jade templates to AngularJS modules for Brunch.IO
31 stars 21 forks source link

Need a way to inject partial templates into Karma unit tests #21

Closed jmafc closed 9 years ago

jmafc commented 10 years ago

I just updated my angular-phonecat-brunch tutorial project to the latest version of jade-angularjs-brunch. While it was a bit difficult to figure out the correct settings for config.coffee and the templateUrl incantations, I managed to get it working, mostly according to this project's README (but see Aside below).

However, in order to make the Karma unit tests to work, I had to not only inject the 'app.templates' module, but also to specify 'public/js/*.templates.js' in the karma.conf.js file. To me, this last step is a kludge, because it requires that I run brunch build first in order to create the app.templates.js file--otherwise the unit tests fail. There ought to be some way of injecting the partials into the tests directly from the app tree.

_ Aside: It's confusing that the "Sample of settings" section is marked "DEPRECATED" since its recommendations appear to be valid and still working. It would also be helpful if there were further explanations of the settings. For example, is the paths.jadeCompileTrigger setting necessary or not? Angular-brunch-seed, for one, doesn't use it. The default of js/dontUseMe is poorly named and angular-brunch-seed calls it (under templates.joinTo) a "dirty hack". I don't know the story behind it but I chose to specify it as .compile-jade (as recommended in your README) which is almost self-explanatory. Also, is the jade_angular.locals context required or just nice-to-have (and if so, why)?

jmafc commented 9 years ago

No longer relevant (at least to me).