Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs : update unit-testing-component-controllers #15974

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions docs/content/guide/component.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -462,23 +462,14 @@ The examples use the [Jasmine](http://jasmine.github.io/) testing framework.

**Controller Test:**
```js
describe('component: heroDetail', function() {
describe('HeroDetailController', function() {
var $componentController;

beforeEach(module('heroApp'));
beforeEach(inject(function(_$componentController_) {
$componentController = _$componentController_;
}));

it('should expose a `hero` object', function() {
// Here we are passing actual bindings to the component
var bindings = {hero: {name: 'Wolverine'}};
var ctrl = $componentController('heroDetail', null, bindings);

expect(ctrl.hero).toBeDefined();
expect(ctrl.hero.name).toBe('Wolverine');
});

it('should call the `onDelete` binding, when deleting the hero', function() {
var onDeleteSpy = jasmine.createSpy('onDelete');
var bindings = {hero: {}, onDelete: onDeleteSpy};
Expand Down