test(compiler): assert translation names pattern (#22960)
PR Close #22960
This commit is contained in:
parent
b9cbe83104
commit
65f296a676
|
@ -9,6 +9,8 @@
|
||||||
import {setup} from '../aot/test_util';
|
import {setup} from '../aot/test_util';
|
||||||
import {compile, expectEmit} from './mock_compile';
|
import {compile, expectEmit} from './mock_compile';
|
||||||
|
|
||||||
|
const TRANSLATION_NAME_REGEXP = /^MSG_[A-Z0-9]+/;
|
||||||
|
|
||||||
describe('i18n support in the view compiler', () => {
|
describe('i18n support in the view compiler', () => {
|
||||||
const angularFiles = setup({
|
const angularFiles = setup({
|
||||||
compileAngular: true,
|
compileAngular: true,
|
||||||
|
@ -60,7 +62,10 @@ describe('i18n support in the view compiler', () => {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = compile(files, angularFiles);
|
const result = compile(files, angularFiles);
|
||||||
expectEmit(result.source, template, 'Incorrect template');
|
expectEmit(result.source, template, 'Incorrect template', {
|
||||||
|
'$msg_1$': TRANSLATION_NAME_REGEXP,
|
||||||
|
'$msg_2$': TRANSLATION_NAME_REGEXP,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add the meaning and description as JsDoc comments', () => {
|
it('should add the meaning and description as JsDoc comments', () => {
|
||||||
|
@ -109,7 +114,9 @@ describe('i18n support in the view compiler', () => {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = compile(files, angularFiles);
|
const result = compile(files, angularFiles);
|
||||||
expectEmit(result.source, template, 'Incorrect template');
|
expectEmit(result.source, template, 'Incorrect template', {
|
||||||
|
'$msg_1$': TRANSLATION_NAME_REGEXP,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -154,7 +161,9 @@ describe('i18n support in the view compiler', () => {
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const result = compile(files, angularFiles);
|
const result = compile(files, angularFiles);
|
||||||
expectEmit(result.source, template, 'Incorrect template');
|
expectEmit(result.source, template, 'Incorrect template', {
|
||||||
|
'$msg_1$': TRANSLATION_NAME_REGEXP,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue