Add more tests
This commit is contained in:
		| @@ -107,4 +107,10 @@ describe('DirectiveParser', () => { | |||||||
| 		const keys = parser.extract(contents, templateFilename).keys(); | 		const keys = parser.extract(contents, templateFilename).keys(); | ||||||
| 		expect(keys).to.deep.equal(['There are currently no students in this class. The good news is, adding students is really easy! Just use the options at the top.']); | 		expect(keys).to.deep.equal(['There are currently no students in this class. The good news is, adding students is really easy! Just use the options at the top.']); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|  | 	it('should extract contents without indent spaces', () => { | ||||||
|  | 		const contents = `<button mat-button (click)="search()" translate>client.search.searchBtn</button>`; | ||||||
|  | 		const keys = parser.extract(contents, templateFilename).keys(); | ||||||
|  | 		expect(keys).to.deep.equal(['client.search.searchBtn']); | ||||||
|  | 	}); | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -35,4 +35,20 @@ describe('MarkerParser', () => { | |||||||
| 		const keys = parser.extract(contents, componentFilename).keys(); | 		const keys = parser.extract(contents, componentFilename).keys(); | ||||||
| 		expect(keys).to.deep.equal(['Hello world', 'This is a very very very very long line.', 'Mix of different types']); | 		expect(keys).to.deep.equal(['Hello world', 'This is a very very very very long line.', 'Mix of different types']); | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|  | 	it('should extract the strings', () => { | ||||||
|  | 		const contents = ` | ||||||
|  | 		import { marker } from '@biesbjerg/ngx-translate-extract-marker'; | ||||||
|  |  | ||||||
|  | 		export class AppModule { | ||||||
|  | 			constructor() { | ||||||
|  | 				marker('DYNAMIC_TRAD.val1'); | ||||||
|  | 				marker('DYNAMIC_TRAD.val2'); | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 		`; | ||||||
|  | 		const keys = parser.extract(contents, componentFilename).keys(); | ||||||
|  | 		expect(keys).to.deep.equal(['DYNAMIC_TRAD.val1', 'DYNAMIC_TRAD.val2']); | ||||||
|  | 	}); | ||||||
|  |  | ||||||
| }); | }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user