import { expect } from 'chai'; import { DirectiveParser } from '../../src/parsers/directive.parser'; describe('DirectiveParser', () => { const templateFilename: string = 'test.template.html'; const componentFilename: string = 'test.component.ts'; let parser: DirectiveParser; beforeEach(() => { parser = new DirectiveParser(); }); it('should extract keys keeping proper whitespace', () => { const contents = `
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 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 extract contents from within custom tags', () => { const contents = `Please leave a message for your client letting them know why you rejected the field and what they need to do to fix it.
`; const keys = parser.extract(contents, templateFilename).keys(); expect(keys).to.deep.equal([ 'Please leave a message for your client letting them know why you rejected the field and what they need to do to fix it.' ]); }); it('should extract contents without indent spaces', () => { const contents = `this is an example of a long label