2015-10-13 00:29:13 -07:00
|
|
|
import {ddescribe, describe, it, iit, xit, expect, afterEach} from 'angular2/testing_internal';
|
2015-11-19 15:09:34 -08:00
|
|
|
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
|
2015-11-17 15:24:36 -08:00
|
|
|
import {Title} from 'angular2/platform/browser';
|
2015-03-09 17:39:18 +01:00
|
|
|
|
|
|
|
export function main() {
|
|
|
|
describe('title service', () => {
|
|
|
|
var initialTitle = DOM.getTitle();
|
|
|
|
var titleService = new Title();
|
|
|
|
|
2015-05-27 13:48:24 -07:00
|
|
|
afterEach(() => { DOM.setTitle(initialTitle); });
|
2015-03-09 17:39:18 +01:00
|
|
|
|
2015-05-27 13:48:24 -07:00
|
|
|
it('should allow reading initial title',
|
|
|
|
() => { expect(titleService.getTitle()).toEqual(initialTitle); });
|
2015-03-09 17:39:18 +01:00
|
|
|
|
|
|
|
it('should set a title on the injected document', () => {
|
|
|
|
titleService.setTitle('test title');
|
|
|
|
expect(DOM.getTitle()).toEqual('test title');
|
|
|
|
expect(titleService.getTitle()).toEqual('test title');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should reset title to empty string if title not provided', () => {
|
|
|
|
titleService.setTitle(null);
|
|
|
|
expect(DOM.getTitle()).toEqual('');
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|