Tests about support of HTML tags in translations keys with GetText (#172)
- Verify that html tags are supported in translation keys - Add typed support of gettext-parser
This commit is contained in:
@@ -36,6 +36,12 @@ describe('DirectiveParser', () => {
|
||||
expect(keys).to.deep.equal(['Hello <strong translate>World</strong>']);
|
||||
});
|
||||
|
||||
it('should not exclude html tags in children', () => {
|
||||
const contents = `<div translate>Hello <strong>World</strong></div>`;
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal(['Hello <strong>World</strong>']);
|
||||
});
|
||||
|
||||
it('should extract and parse inline template', () => {
|
||||
const contents = `
|
||||
@Component({
|
||||
|
@@ -36,6 +36,17 @@ describe('MarkerParser', () => {
|
||||
expect(keys).to.deep.equal(['Hello world', 'This is a very very very very long line.', 'Mix of different types']);
|
||||
});
|
||||
|
||||
it('should extract split strings while keeping html tags', () => {
|
||||
const contents = `
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
_('Hello ' + 'world');
|
||||
_('This <em>is</em> a ' + 'very ' + 'very ' + 'very ' + 'very ' + 'long line.');
|
||||
_('Mix ' + \`of \` + 'different ' + \`types\`);
|
||||
`;
|
||||
const keys = parser.extract(contents, componentFilename).keys();
|
||||
expect(keys).to.deep.equal(['Hello world', 'This <em>is</em> 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';
|
||||
|
Reference in New Issue
Block a user