Trim leading/trailing whitespace. Closes #175
This commit is contained in:
parent
05d1917f9d
commit
3bf2aaca4e
@ -82,6 +82,6 @@ export class DirectiveParser implements ParserInterface {
|
||||
}
|
||||
|
||||
protected cleanKey(val: string): string {
|
||||
return val.replace(/\r?\n|\r|\t/g, '');
|
||||
return val.replace(/\r?\n|\r|\t/g, '').trim();
|
||||
}
|
||||
}
|
||||
|
@ -117,4 +117,22 @@ describe('DirectiveParser', () => {
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal(['client.search.searchBtn']);
|
||||
});
|
||||
|
||||
it('should extract contents without indent spaces and trim leading/trailing whitespace', () => {
|
||||
const contents = `
|
||||
<div translate>
|
||||
this is an example
|
||||
of a long label
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p translate>
|
||||
this is an example
|
||||
of a long label
|
||||
</p>
|
||||
</div>
|
||||
`;
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal(['this is an example of a long label']);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user