Hi Jonathan!
Here is a working test in the jsFiddle:
http://jsfiddle.net/7dTU2/
The problem was in the way you've declared your module, it should have been:
var myPortal = angular.module('myPortal', []) <- notice the []
while it was:
var myPortal = angular.module('myPortal')
If I may suggest other thing: using the $window service
(
http://docs.angularjs.org/api/ng.$window) instead of the global
window object would allow you to test more!
Cheers,
Pawel
On Tue, Oct 23, 2012 at 12:14 PM, Jonathan Meiss <
jona...@meiss.fr> wrote:
> Hi,
>
> I've wrote few unit tests but I can't get it working.
> I've tried to write a jsfiddle here:
http://jsfiddle.net/cXxvJ/1/ to see my
> code in action.
> And this is my stack trace in my console when I launch the test:
>
> Language controller LanguageCtrl.should set rootScope.locale as browser
> language failed (35.00 ms): Error: Error: Argument 'LanguageCtrl' is not a
> function, got undefined
> Error: Expected undefined to be 'en'.
> Error: Argument 'LanguageCtrl' is not a function, got undefined
> at assertArg (app/lib/angular/angular.js:973:11)
> at assertArgFn (app/lib/angular/angular.js:983:3)
> at app/lib/angular/angular.js:4618:9
> at null.<anonymous> (test/unit/controllersSpec.js:67:19)
> at Object.invoke (app/lib/angular/angular.js:2795:28)
> at workFn (test/lib/angular/angular-mocks.js:1711:20)
> Error: Declaration Location
> at window.jasmine.window.inject.angular.mock.inject
> (test/lib/angular/angular-mocks.js:1697:17)
> at null.<anonymous> (test/unit/controllersSpec.js:65:16)
> at null.<anonymous> (test/unit/controllersSpec.js:62:3)
>
> Error: Expected undefined to be 'en'.
> at null.<anonymous> (test/unit/controllersSpec.js:71:32)
>
> Did anybody has any idea of where is the problem and help me to fix it?
>
> Thanks for your help!
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To post to this group, send email to
ang...@googlegroups.com.
> To unsubscribe from this group, send email to
>
angular+u...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/angular?hl=en.
>
>
--
Question? Send a fiddle
(
http://jsfiddle.net/pkozlowski_opensource/Q2NpJ/) or a plunk
(
http://plnkr.co/)
Need help with jsFiddle? Check this:
http://pkozlowskios.wordpress.com/2012/08/12/using-jsfiddle-with-angularjs/
Looking for UI widget library for AngularJS? Here you go:
http://angular-ui.github.com/