Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(compiler): assert translation names pattern #22960

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/compiler/test/render3/r3_view_compiler_i18n_spec.ts
Expand Up @@ -9,6 +9,8 @@
import {setup} from '../aot/test_util';
import {compile, expectEmit} from './mock_compile';

const TRANSLATION_NAME_REGEXP = /^MSG_[A-Z0-9]+/;

describe('i18n support in the view compiler', () => {
const angularFiles = setup({
compileAngular: true,
Expand Down Expand Up @@ -60,7 +62,10 @@ describe('i18n support in the view compiler', () => {
`;

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', () => {
Expand Down Expand Up @@ -109,7 +114,9 @@ describe('i18n support in the view compiler', () => {
`;

const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
expectEmit(result.source, template, 'Incorrect template', {
'$msg_1$': TRANSLATION_NAME_REGEXP,
});
});
});

Expand Down Expand Up @@ -154,7 +161,9 @@ describe('i18n support in the view compiler', () => {
`;

const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
expectEmit(result.source, template, 'Incorrect template', {
'$msg_1$': TRANSLATION_NAME_REGEXP,
});
});
});

Expand Down