Configured cheerio to work with non-HTML standard elements to fix issues with custom component tags. (#79)
This commit is contained in:
parent
ee28fe2a64
commit
4892ea5146
@ -2,7 +2,9 @@ import { ParserInterface } from './parser.interface';
|
||||
import { AbstractTemplateParser } from './abstract-template.parser';
|
||||
import { TranslationCollection } from '../utils/translation.collection';
|
||||
|
||||
import * as $ from 'cheerio';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
const $ = cheerio.load('', {xmlMode: true});
|
||||
|
||||
export class DirectiveParser extends AbstractTemplateParser implements ParserInterface {
|
||||
|
||||
|
@ -118,4 +118,10 @@ describe('DirectiveParser', () => {
|
||||
expect(template).to.equal('<p translate="KEY">Hello World</p>');
|
||||
});
|
||||
|
||||
it('should extract contents from within custom tags', () => {
|
||||
const contents = `<custom-table><tbody><tr><td translate>Hello World</td></tr></tbody></custom-table>`;
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal(['Hello World']);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user