(test) add test
This commit is contained in:
		| @@ -29,7 +29,7 @@ export class PoCompiler implements CompilerInterface { | |||||||
| 						msgstr: collection.get(key) | 						msgstr: collection.get(key) | ||||||
| 					}; | 					}; | ||||||
| 					return translations; | 					return translations; | ||||||
| 				}, <any> {}) | 				}, {} as any) | ||||||
| 			} | 			} | ||||||
| 		}; | 		}; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| export interface TranslationType { | export interface TranslationType { | ||||||
| 	[key: string]: string | 	[key: string]: string; | ||||||
| } | } | ||||||
|  |  | ||||||
| export class TranslationCollection { | export class TranslationCollection { | ||||||
| @@ -18,7 +18,7 @@ export class TranslationCollection { | |||||||
| 		const values = keys.reduce((results, key) => { | 		const values = keys.reduce((results, key) => { | ||||||
| 			results[key] = ''; | 			results[key] = ''; | ||||||
| 			return results; | 			return results; | ||||||
| 		}, <TranslationType> {}); | 		}, {} as TranslationType); | ||||||
| 		return new TranslationCollection({ ...this.values, ...values }); | 		return new TranslationCollection({ ...this.values, ...values }); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -31,6 +31,18 @@ describe('Utils', () => { | |||||||
| 		expect(template).to.equal('<p translate>Hello World</p>'); | 		expect(template).to.equal('<p translate>Hello World</p>'); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|  | 	it('should extract inline template without html', () => { | ||||||
|  | 		const contents = ` | ||||||
|  | 			@Component({ | ||||||
|  | 				selector: 'test', | ||||||
|  | 				template: 'Hello World' | ||||||
|  | 			}) | ||||||
|  | 			export class TestComponent { } | ||||||
|  | 		`; | ||||||
|  | 		const template = extractComponentInlineTemplate(contents); | ||||||
|  | 		expect(template).to.equal('Hello World'); | ||||||
|  | 	}); | ||||||
|  |  | ||||||
| 	it('should extract inline template spanning multiple lines', () => { | 	it('should extract inline template spanning multiple lines', () => { | ||||||
| 		const contents = ` | 		const contents = ` | ||||||
| 			@Component({ | 			@Component({ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user