fix(compiler): remove i18n markup even if no translations (#17999)

Fixes #11042
This commit is contained in:
Victor Berchet
2017-07-07 16:16:49 -07:00
committed by Jason Aden
parent 2ba3ada27f
commit 9c3386b1b7
11 changed files with 149 additions and 31 deletions

View File

@ -12,6 +12,7 @@ import * as path from 'path';
import {MultipleComponentsMyComp} from '../src/a/multiple_components';
import {BasicComp} from '../src/basic';
import {createComponent} from './util';
import {createComponentAlt} from './util_alt';
describe('template codegen output', () => {
const outDir = 'src';
@ -88,5 +89,17 @@ describe('template codegen output', () => {
const pText = pElement.children.map((c: any) => c.data).join('').trim();
expect(pText).toBe('tervetuloa');
});
it('should have removed i18n markup', () => {
const containerElement = createComponent(BasicComp).debugElement.children[0];
expect(containerElement.attributes['title']).toBe('käännä teksti');
expect(containerElement.attributes['i18n-title']).toBeUndefined();
});
it('should have removed i18n markup event without translations', () => {
const containerElement = createComponentAlt(BasicComp).debugElement.children[0];
expect(containerElement.attributes['title']).toBe('translate me');
expect(containerElement.attributes['i18n-title']).toBeUndefined();
});
});
});