blob: 0959e57216b0ddf1963a72b558a48cd3741eb724 [file] [log] [blame]
Matteo Scandoloa4a47112016-12-16 10:06:13 -08001import * as angular from 'angular';
2import 'angular-mocks';
3import 'angular-ui-router';
4import {xosCore} from '../index';
5import {IXosPageTitleService} from './page-title';
6import IWindowService = angular.IWindowService;
7import {StyleConfig} from '../../config/style.config';
8
9let service: IXosPageTitleService, $window: IWindowService;
10describe('The PageTitle service', () => {
11
12 beforeEach(angular.mock.module(xosCore));
13
14 beforeEach(angular.mock.inject((
15 PageTitle: IXosPageTitleService,
16 _$window_: IWindowService
17 ) => {
18 service = PageTitle;
19 $window = _$window_;
20 }));
21
22 it('should get the page title', () => {
23 $window.document.title = 'test';
24 expect(service.get()).toEqual('test');
25 });
26
27 it('should set a page title', () => {
28 service.set('sample');
29 expect($window.document.title).toEqual(`${StyleConfig.projectName} - sample`);
30 });
Matteo Scandoloee655a12016-12-19 15:38:43 -080031
32 it('should convert dots to >', () => {
33 service.set('core.sample.bread.crumb');
34 expect($window.document.title).toEqual(`${StyleConfig.projectName} - core > sample > bread > crumb`);
35 });
Matteo Scandoloa4a47112016-12-16 10:06:13 -080036});