Hallo.
I need your help with unit testing my AngularJS work.

The app modul

> var app = angular.module('App', [ 
>     'AppCtrl'
> ]);
>

The controller modul

> var appCtrl = angular.module('AppCtrl', []); 
>

The controller I want to test.

> appCtrl.controller('SignalListCtrl', ['$scope', 
>     function($scope) {  
>         $scope.name = "World";
> }]);
>
 
I want to test $scope.name, but in the unit test, it is undefined. I don't 
know where the error is. 

> describe('Controller', function() {
>
>     var scope, controller;
>     
>     beforeEach(function() {
>         module('AppCtrl');
>     });
>
>     beforeEach(inject(function ($controller, $rootScope) {
>         scope = $rootScope.$new();
>         controller = $controller("SignalListCtrl", {
>             $scope: scope
>         });
>     }));
>
>     it('should expect name to be World', function () {
>         expect(scope.name).toBe("World");
>     });
> });
>

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" 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/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to