Fix bug in DirectiveParser: should not extract translate pipe in html tag
This commit is contained in:
parent
4307e4bde8
commit
43df1f0fb8
@ -18,9 +18,11 @@ export class DirectiveParser extends AbstractTemplateParser implements ParserInt
|
||||
let collection: TranslationCollection = new TranslationCollection();
|
||||
|
||||
template = this._normalizeTemplateAttributes(template);
|
||||
|
||||
const selector = '[translate], [ng2-translate]';
|
||||
$(template)
|
||||
.find('[translate], [ng2-translate]')
|
||||
.addBack()
|
||||
.find(selector)
|
||||
.addBack(selector)
|
||||
.each((i: number, element: CheerioElement) => {
|
||||
const $element = $(element);
|
||||
const attr = $element.attr('translate') || $element.attr('ng2-translate');
|
||||
|
@ -98,4 +98,10 @@ describe('DirectiveParser', () => {
|
||||
expect(keys).to.deep.equal(['KEY']);
|
||||
});
|
||||
|
||||
it('should not extract translate pipe in html tag', () => {
|
||||
const contents = `<p>{{ 'Audiobooks for personal development' | translate }}</p>`;
|
||||
const collection = parser.extract(contents, templateFilename);
|
||||
expect(collection.values).to.deep.equal({});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user