diff --git a/modules/@angular/compiler/test/i18n/serializers/xliff_spec.ts b/modules/@angular/compiler/test/i18n/serializers/xliff_spec.ts index 2dcadf090d..1db9851132 100644 --- a/modules/@angular/compiler/test/i18n/serializers/xliff_spec.ts +++ b/modules/@angular/compiler/test/i18n/serializers/xliff_spec.ts @@ -112,8 +112,8 @@ export function main(): void { }); }); - describe('errors', () => { - it('should throw when a placeholder has no id attribute', () => { + describe('structure errors', () => { + it('should throw when a trans-unit has no id attribute', () => { const XLIFF = ` @@ -131,25 +131,7 @@ export function main(): void { }).toThrowError(/ misses the "id" attribute/); }); - it('should throw on unknown message tags', () => { - const XLIFF = ` - - - - - - msg should contain only ph tags - - - -`; - - expect(() => { loadAsMap(XLIFF); }) - .toThrowError( - new RegExp(escapeRegExp(`[ERROR ->]msg should contain only ph tags`))); - }); - - it('should throw when a placeholder has no name attribute', () => { + it('should throw on duplicate trans-unit id', () => { const XLIFF = ` @@ -171,6 +153,45 @@ export function main(): void { }).toThrowError(/Duplicated translations for msg deadbeef/); }); }); + + describe('message errors', () => { + it('should throw on unknown message tags', () => { + const XLIFF = ` + + + + + + msg should contain only ph tags + + + +`; + + expect(() => { loadAsMap(XLIFF); }) + .toThrowError( + new RegExp(escapeRegExp(`[ERROR ->]msg should contain only ph tags`))); + }); + + it('should throw when a placeholder misses an id attribute', () => { + const XLIFF = ` + + + + + + + + + +`; + + expect(() => { + loadAsMap(XLIFF); + }).toThrowError(new RegExp(escapeRegExp(` misses the "id" attribute`))); + }); + + }); }); }); } \ No newline at end of file