Fix tests

This commit is contained in:
Kim Biesbjerg 2016-12-23 05:23:33 +01:00
parent d0730431d0
commit e0f909fb4f
2 changed files with 16 additions and 12 deletions

View File

@ -8,10 +8,6 @@ class TestTemplateParser extends AbstractTemplateParser {
return this._isAngularComponent(filePath); return this._isAngularComponent(filePath);
} }
public normalizeTemplateAttributes(template: string): string {
return this._normalizeTemplateAttributes(template);
}
public extractInlineTemplate(contents: string): string { public extractInlineTemplate(contents: string): string {
return this._extractInlineTemplate(contents); return this._extractInlineTemplate(contents);
} }
@ -41,12 +37,6 @@ describe('AbstractTemplateParser', () => {
expect(result).to.equal(false); expect(result).to.equal(false);
}); });
it('should normalize bound attributes', () => {
const contents = `<p [translate]="'KEY'">Hello World</p>`;
const template = parser.normalizeTemplateAttributes(contents);
expect(template).to.equal('<p translate="KEY">Hello World</p>');
});
it('should extract inline template', () => { it('should extract inline template', () => {
const contents = ` const contents = `
@Component({ @Component({

View File

@ -2,15 +2,23 @@ import { expect } from 'chai';
import { DirectiveParser } from '../../src/parsers/directive.parser'; import { DirectiveParser } from '../../src/parsers/directive.parser';
class TestDirectiveParser extends DirectiveParser {
public normalizeTemplateAttributes(template: string): string {
return this._normalizeTemplateAttributes(template);
}
}
describe('DirectiveParser', () => { describe('DirectiveParser', () => {
const templateFilename: string = 'test.template.html'; const templateFilename: string = 'test.template.html';
const componentFilename: string = 'test.component.ts'; const componentFilename: string = 'test.component.ts';
let parser: DirectiveParser; let parser: TestDirectiveParser;
beforeEach(() => { beforeEach(() => {
parser = new DirectiveParser(); parser = new TestDirectiveParser();
}); });
it('should extract contents when no translate attribute value is provided', () => { it('should extract contents when no translate attribute value is provided', () => {
@ -104,4 +112,10 @@ describe('DirectiveParser', () => {
expect(collection.values).to.deep.equal({}); expect(collection.values).to.deep.equal({});
}); });
it('should normalize bound attributes', () => {
const contents = `<p [translate]="'KEY'">Hello World</p>`;
const template = parser.normalizeTemplateAttributes(contents);
expect(template).to.equal('<p translate="KEY">Hello World</p>');
});
}); });