@@ -420,18 +420,19 @@ The examples use the [Jasmine](http://jasmine.github.io/) testing framework.
420
420
**Controller Test:**
421
421
```js
422
422
describe('component: heroDetail', function() {
423
- var component, scope, hero;
423
+ var component, scope, hero, componentController ;
424
424
425
425
beforeEach(module('simpleComponent'));
426
426
427
427
beforeEach(inject(function($rootScope, $componentController) {
428
428
scope = $rootScope.$new();
429
+ componentController = $componentController;
429
430
hero = {name: 'Wolverine'};
430
431
}));
431
432
432
433
it('should set the default values of the hero', function() {
433
434
// It's necessary to always pass the scope in the locals, so that the controller instance can be bound to it
434
- component = $ componentController('heroDetail', {$scope: scope});
435
+ component = componentController('heroDetail', {$scope: scope});
435
436
436
437
expect(component.hero).toEqual({
437
438
name: undefined,
@@ -442,15 +443,15 @@ describe('component: heroDetail', function() {
442
443
it('should assign the name bindings to the hero object', function() {
443
444
// Here we are passing actual bindings to the component
444
445
445
- component = $ componentController('heroDetail',
446
+ component = componentController('heroDetail',
446
447
{$scope: scope},
447
448
{hero: hero}
448
449
);
449
450
expect(component.hero.name).toBe('Wolverine');
450
451
});
451
452
452
453
it('should call the onDelete binding when a hero is deleted', function() {
453
- component = $ componentController('heroDetail',
454
+ component = componentController('heroDetail',
454
455
{$scope: scope},
455
456
{hero: hero, onDelete: jasmine.createSpy('deleteSpy')}
456
457
);
0 commit comments