Matteo Scandolo | a4a4711 | 2016-12-16 10:06:13 -0800 | [diff] [blame] | 1 | import * as angular from 'angular'; |
| 2 | import 'angular-mocks'; |
| 3 | import 'angular-ui-router'; |
| 4 | import {xosCore} from '../index'; |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 5 | import {IXosRuntimeStatesService} from './runtime-states'; |
Matteo Scandolo | a4a4711 | 2016-12-16 10:06:13 -0800 | [diff] [blame] | 6 | |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 7 | let service: IXosRuntimeStatesService, $state: ng.ui.IStateService; |
Matteo Scandolo | a4a4711 | 2016-12-16 10:06:13 -0800 | [diff] [blame] | 8 | |
| 9 | describe('The Navigation service', () => { |
| 10 | |
| 11 | beforeEach(angular.mock.module(xosCore)); |
| 12 | |
| 13 | beforeEach(angular.mock.inject(( |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 14 | XosRuntimeStates: IXosRuntimeStatesService, |
Matteo Scandolo | a4a4711 | 2016-12-16 10:06:13 -0800 | [diff] [blame] | 15 | _$state_: ng.ui.IStateService |
| 16 | ) => { |
Matteo Scandolo | 1aee198 | 2017-02-17 08:33:23 -0800 | [diff] [blame] | 17 | service = XosRuntimeStates; |
Matteo Scandolo | a4a4711 | 2016-12-16 10:06:13 -0800 | [diff] [blame] | 18 | $state = _$state_; |
| 19 | })); |
| 20 | |
| 21 | it('should add a state', () => { |
| 22 | service.addState('testState', { |
| 23 | url: 'test-state', |
| 24 | template: 'test-state' |
| 25 | }); |
| 26 | |
| 27 | expect($state.get('testState').url).toEqual('test-state'); |
| 28 | expect($state.get('testState').template).toEqual('test-state'); |
| 29 | }); |
| 30 | }); |