Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 1 | /// <reference path="../../../../typings/index.d.ts" /> |
| 2 | |
| 3 | import * as angular from 'angular'; |
| 4 | import 'angular-mocks'; |
| 5 | import {xosHeader} from './header'; |
| 6 | import {StyleConfig} from '../../config/style.config'; |
Matteo Scandolo | 63e43eb | 2016-12-14 14:18:53 -0800 | [diff] [blame] | 7 | import {Subject} from 'rxjs'; |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 8 | |
| 9 | describe('header component', () => { |
| 10 | beforeEach(() => { |
| 11 | angular |
| 12 | .module('xosHeader', ['app/core/header/header.html']) |
Matteo Scandolo | 63e43eb | 2016-12-14 14:18:53 -0800 | [diff] [blame] | 13 | .component('xosHeader', xosHeader) |
| 14 | .service('SynchronizerStore', function(){ |
| 15 | const events = new Subject(); |
| 16 | this.query = () => { |
| 17 | return events.asObservable(); |
| 18 | }; |
| 19 | }); |
Matteo Scandolo | f6acdbe | 2016-12-13 10:29:37 -0800 | [diff] [blame] | 20 | angular.mock.module('xosHeader'); |
| 21 | }); |
| 22 | |
| 23 | it('should render the appropriate title', angular.mock.inject(($rootScope: ng.IRootScopeService, $compile: ng.ICompileService) => { |
| 24 | const element = $compile('<xos-header></xos-header>')($rootScope); |
| 25 | $rootScope.$digest(); |
| 26 | const header = element.find('a'); |
| 27 | expect(header.html().trim()).toEqual(StyleConfig.projectName); |
| 28 | })); |
| 29 | }); |