fix(partition): fix partition when <!-- i18n --> is the only child

This commit is contained in:
Victor Berchet
2016-06-17 15:00:26 -07:00
parent 04a50f5832
commit 58b18d7fe7
2 changed files with 32 additions and 27 deletions

View File

@ -10,8 +10,8 @@ export function main() {
let extractor: MessageExtractor;
beforeEach(() => {
let htmlParser = new HtmlParser();
var parser = new Parser(new Lexer());
const htmlParser = new HtmlParser();
const parser = new Parser(new Lexer());
extractor = new MessageExtractor(htmlParser, parser, ['i18n-tag'], {'i18n-el': ['trans']});
});
@ -153,7 +153,7 @@ export function main() {
new Message('value', 'meaning', 'desc')
]);
});
it('should remove duplicate messages', () => {
let res = extractor.extract(
`
@ -203,12 +203,14 @@ export function main() {
expect(res.errors[0].msg).toEqual('Missing attribute \'title2\'.');
});
it('should error when cannot find a matching desc', () => {
let res = extractor.extract(
`
<!-- i18n: meaning1|desc1 -->message1`,
'someUrl');
it('should error when i18n comments are unbalanced', () => {
const res = extractor.extract('<!-- i18n -->message1', 'someUrl');
expect(res.errors.length).toEqual(1);
expect(res.errors[0].msg).toEqual('Missing closing \'i18n\' comment.');
});
it('should error when i18n comments are unbalanced', () => {
const res = extractor.extract('<!-- i18n -->', 'someUrl');
expect(res.errors.length).toEqual(1);
expect(res.errors[0].msg).toEqual('Missing closing \'i18n\' comment.');
});