-
-
Save gdyrrahitis/536a9e9d56a506491a90c0c260de92e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare type Locals = { $scope?: ng.IScope, [key: string]: any }; | |
let createComponent: (name: string, locals: Locals, bindings: any) => any; | |
let $state: ng.ui.IStateService; | |
let scope: ng.IScope; | |
beforeEach(inject((_$componentController_: ng.IComponentControllerService, _$state_, _$rootScope_) => { | |
createComponent = (name, locals: Locals, bindings) => _$componentController_(name, locals, bindings); | |
$state = _$state_; | |
scope = _$rootScope_.$new(); | |
})); | |
it("should navigate to /todo/:id when method is called", () => { | |
// arrange | |
let component = createComponent("todoHome", { $scope: scope }, {}); | |
// act | |
component.showTodo("1"); | |
scope.$digest(); | |
// assert | |
expect($state.current.name).toBe("todo"); | |
expect($state.href($state.current.name)).toBe("/todo/1"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment