Closed fatuhoku closed 11 years ago
@fushunpoon,
Thanks for using angular-brunch-seed. I've add a test to demonstrate Controller tests. The problem is that angular-brunch-seed doesn't use Global controllers, therefore the controller must be referenced using $controller
and the string name of the controller, E.g.
describe "MyCtrl1", ->
it "should make scope testable", inject ($rootScope, $controller) ->
scope = $rootScope.$new()
ctrl = $controller "MyCtrl1",
$scope: scope,
expect(scope.onePlusOne).toEqual(2)
Here's the commit. 8106abdc98a0e4b8c8f5ea8085d415f0da96a002 Please let me know if this helps.
Thank you,
Kyle
@fushunpoon I'm going to go head a close this issue. Please feel free to reopen it or create a new one if I haven't answered your question.
Reproduction:
I checked out the repo and I tried to follow the AngularJS (you can try this yourself) tutorial to develop the phone example. However, when I declare a Jasmine test for `PhoneListCtrl, it's very unclear to me how a reference to the controller is resolved.
As a result, when I run
./scripts/test.sh
I get:How are controllers supposed to be exposed to testacular at all? This is blocking my use of angular-brunch-seed. It is otherwise, I'm sure, a fine piece of work!