| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  | import {ddescribe, describe, it, iit, xit, expect, afterEach} from '@angular/core/testing'; | 
					
						
							|  |  |  | import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; | 
					
						
							|  |  |  | import {Title} from '@angular/platform-browser'; | 
					
						
							| 
									
										
										
										
											2015-03-09 17:39:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function main() { | 
					
						
							|  |  |  |   describe('title service', () => { | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |     var initialTitle = getDOM().getTitle(); | 
					
						
							| 
									
										
										
										
											2015-03-09 17:39:18 +01:00
										 |  |  |     var titleService = new Title(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |     afterEach(() => { getDOM().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'); | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |       expect(getDOM().getTitle()).toEqual('test title'); | 
					
						
							| 
									
										
										
										
											2015-03-09 17:39:18 +01:00
										 |  |  |       expect(titleService.getTitle()).toEqual('test title'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('should reset title to empty string if title not provided', () => { | 
					
						
							|  |  |  |       titleService.setTitle(null); | 
					
						
							| 
									
										
										
										
											2016-04-28 17:50:03 -07:00
										 |  |  |       expect(getDOM().getTitle()).toEqual(''); | 
					
						
							| 
									
										
										
										
											2015-03-09 17:39:18 +01:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } |