OK, I just found the solution here: http://stackoverflow.com/questions/19403472/angularjs-angular-phonecat-tutorial-app-fails-first-unit-test
FYI... On Thursday, May 29, 2014 10:02:50 PM UTC-7, dorono wrote: > > Haha, that's funny. :P > > Yeah, I had actually tried looking over that file, and even hard-coded the > file name of my controller file into that list of files, but still no luck. > It's so wierd, I have no clue why this would be happening. > > So if anyone else has any ideas, I would be eternally grateful! > > Thanks! > > Doron > > > > On Wednesday, May 28, 2014 10:31:53 PM UTC-7, Daphne Maddox wrote: >> >> You're not dense but I was being dense! I just randomly for no good >> reason assumed a mocha-like setup which is obviously not what's going on >> here. Ignore my comment about a test runner file (and undo the changes you >> made trying to interpret my silliness). >> >> This line in the karma configuration should be ensuring that your >> controller is loaded before the tests: >> https://github.com/angular/angular-phonecat/blob/step-2/test/karma.conf.js#L10 >> >> So I don't know what might be going wrong. Maybe someone can show how >> you get into debug mode in karma or knows a typical reason that this would >> happen in the tutorial. One way or the other signs are pointing to a >> situation where your controller may not be (properly) registered prior to >> the test executing. Sorry I can't be of more help, I'm a mocha chick. :( >> >> >> On Wednesday, May 28, 2014 9:30:21 PM UTC-7, dorono wrote: >>> >>> Thanks, Daphne! >>> >>> Excuse me if I sound dense, but by test runner html file, do you mean >>> the html file with the markup for the page I'm testing? If so, I'm not sure >>> where the test is included, since I don't believe that it's to be included >>> in the head of the html file, but of course, it is running on my local npm >>> server. I did try taking the controller code out of the separate js file it >>> was living in, and move it to the <head> tag, but that didn't fix it. >>> >>> Whaddyafink? >>> >>> Thanks again! >>> >>> D >>> >>> >>> On Tuesday, May 27, 2014 10:41:11 PM UTC-7, Daphne Maddox wrote: >>>> >>>> I haven't gone through the tutorial but that error message can be >>>> misleading. It's the same one you get if the controller has *never* been >>>> defined, so you might want to verify that the file that contains the >>>> controller is included in your test runner html file *before* the test >>>> that >>>> tries to run it is included. >>>> >>>> On Tuesday, May 27, 2014 9:26:45 PM UTC-7, dorono wrote: >>>>> >>>>> Hello there, >>>>> >>>>> I am an Angular newbie, and was going through the tutorial on the >>>>> Angular site (https://docs.angularjs.org/tutorial/), and noticed that >>>>> although the app seemed to be functioning properly, the code was failing >>>>> the jasmine unit test. >>>>> >>>>> Here's what I'm getting in the log: >>>>> >>>>> Chrome 35.0.1916 (Mac OS X 10.9.3): Executed 1 of 2 (1 FAILED) (0 >>>>> secs / 0.02 seChrome 35.0.1916 (Mac OS X 10.9.3) PhoneCat controllers >>>>> PhoneListCtrl should set the default value of orderProp model FAILED >>>>> >>>>> Error: [ng:areq] Argument 'PhoneListCtrl' is not a function, got >>>>> undefined >>>>> >>>>> Here's what's in my jasmine test file: >>>>> >>>>> 'use strict'; >>>>> >>>>> /* jasmine specs for controllers go here */ >>>>> >>>>> describe('PhoneCat controllers', function() { >>>>> >>>>> describe('PhoneListCtrl', function(){ >>>>> >>>>> var scope, ctrl; >>>>> >>>>> beforeEach(module('phonecatApp')); >>>>> >>>>> beforeEach(inject(function($controller) { >>>>> >>>>> scope = {}; >>>>> >>>>> ctrl = $controller('PhoneListCtrl', {$scope:scope}); >>>>> >>>>> })); >>>>> >>>>> it('should create "phones" model with 3 phones', >>>>> inject(function($controller) { >>>>> >>>>> expect(scope.phones.length).toBe(3); >>>>> >>>>> })); >>>>> >>>>> it('should set the default value of orderProp model', function() { >>>>> >>>>> expect(scope.orderProp).toBe('age'); >>>>> >>>>> }); >>>>> >>>>> }); >>>>> >>>>> }); >>>>> And here's what's in my controller: >>>>> 'use strict'; >>>>> >>>>> /* Controllers */ >>>>> >>>>> var phonecatApp = angular.module('phonecatApp', []); >>>>> >>>>> phonecatApp.controller('PhoneListCtrl', function($scope) { >>>>> $scope.phones = [ >>>>> {'name': 'Nexus S', >>>>> 'snippet': 'Fast just got faster with Nexus S.', >>>>> 'age': 1}, >>>>> {'name': 'Motorola XOOMâ„¢ with Wi-Fi', >>>>> 'snippet': 'The Next, Next Generation tablet.', >>>>> 'age': 2}, >>>>> {'name': 'MOTOROLA XOOMâ„¢', >>>>> 'snippet': 'The Next, Next Generation tablet.', >>>>> 'age': 3} >>>>> ]; >>>>> >>>>> $scope.orderProp = 'age'; >>>>> }); >>>>> >>>>> Has anyone gone through the tutorial and had this same issue? >>>>> >>>>> Thanks! >>>>> >>>>> Doron >>>>> >>>> -- 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 angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.