import { expect } from 'chai'; import { DirectiveParser } from '../../src/parsers/directive.parser'; class TestDirectiveParser extends DirectiveParser { public normalizeTemplateAttributes(template: string): string { return this._normalizeTemplateAttributes(template); } } describe('DirectiveParser', () => { const templateFilename: string = 'test.template.html'; const componentFilename: string = 'test.component.ts'; let parser: TestDirectiveParser; beforeEach(() => { parser = new TestDirectiveParser(); }); it('should extract contents when no translate attribute value is provided', () => { const contents = '
Hi there
Lorem Ipsum
Hello World
' }) export class TestComponent { } `; const keys = parser.extract(contents, componentFilename).keys(); expect(keys).to.deep.equal(['Hello World']); }); it('should extract contents when no ng2-translate attribute value is provided', () => { const contents = '{{ 'Audiobooks for personal development' | translate }}
`; const collection = parser.extract(contents, templateFilename); expect(collection.values).to.deep.equal({}); }); it('should normalize bound attributes', () => { const contents = `Hello World
`; const template = parser.normalizeTemplateAttributes(contents); expect(template).to.equal('Hello World
'); }); it('should extract contents from within custom tags', () => { const contents = `