Skip to content

Commit

Permalink
test(compiler): assert translation names pattern (#22960)
Browse files Browse the repository at this point in the history
PR Close #22960
  • Loading branch information
vicb authored and matsko committed Mar 23, 2018
1 parent b9cbe83 commit 65f296a
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/compiler/test/render3/r3_view_compiler_i18n_spec.ts
Original file line number Diff line number Diff line change
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

0 comments on commit 65f296a

Please sign in to comment.