Add tests for PipeParser
This commit is contained in:
parent
c2aac9c257
commit
85a1d04c96
33
tests/pipe.parser.spec.ts
Normal file
33
tests/pipe.parser.spec.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { PipeParser } from '../src/parsers/pipe.parser';
|
||||
|
||||
describe('PipeParser', () => {
|
||||
|
||||
const templateFilename: string = 'test.template.html';
|
||||
|
||||
let parser: PipeParser;
|
||||
|
||||
beforeEach(() => {
|
||||
parser = new PipeParser();
|
||||
});
|
||||
|
||||
it('should extract interpolated strings using translate pipe', () => {
|
||||
const contents = `Hello {{ 'World' | translate }}`;
|
||||
const messages = parser.process(templateFilename, contents);
|
||||
expect(messages).to.deep.equal(['World']);
|
||||
});
|
||||
|
||||
it('should extract interpolated strings using translate pipe in attributes', () => {
|
||||
const contents = `<span attr="{{ 'Hello World' | translate }}"></span>`;
|
||||
const messages = parser.process(templateFilename, contents);
|
||||
expect(messages).to.deep.equal(['Hello World']);
|
||||
});
|
||||
|
||||
it('should extract bound strings using translate pipe in attributes', () => {
|
||||
const contents = `<span [attr]="'Hello World' | translate"></span>`;
|
||||
const messages = parser.process(templateFilename, contents);
|
||||
expect(messages).to.deep.equal(['Hello World']);
|
||||
});
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user