- (feat) add concept of post processors

- (feat) add 'key as default value' post processor (closes #109)
- (chore) move clean functionality to a post processor
- (chore) move sort functionality to a post processor
- (refactor) get rid of leading underscore on protected properties/methods
This commit is contained in:
Kim Biesbjerg
2019-06-11 23:06:47 +02:00
parent ab29c9ab67
commit 102286a209
22 changed files with 342 additions and 171 deletions

View File

@@ -5,11 +5,11 @@ import { AbstractTemplateParser } from '../../src/parsers/abstract-template.pars
class TestTemplateParser extends AbstractTemplateParser {
public isAngularComponent(filePath: string): boolean {
return this._isAngularComponent(filePath);
return super.isAngularComponent(filePath);
}
public extractInlineTemplate(contents: string): string {
return this._extractInlineTemplate(contents);
return super.extractInlineTemplate(contents);
}
}

View File

@@ -5,7 +5,7 @@ import { DirectiveParser } from '../../src/parsers/directive.parser';
class TestDirectiveParser extends DirectiveParser {
public normalizeTemplateAttributes(template: string): string {
return this._normalizeTemplateAttributes(template);
return super.normalizeTemplateAttributes(template);
}
}

View File

@@ -4,10 +4,6 @@ import { ServiceParser } from '../../src/parsers/service.parser';
class TestServiceParser extends ServiceParser {
/*public getInstancePropertyName(): string {
return this._getInstancePropertyName();
}*/
}
describe('ServiceParser', () => {
@@ -20,20 +16,6 @@ describe('ServiceParser', () => {
parser = new TestServiceParser();
});
/*it('should extract variable used for TranslateService', () => {
const contents = `
@Component({ })
export class AppComponent {
public constructor(
_serviceA: ServiceA,
public _serviceB: ServiceB,
protected _translateService: TranslateService
) { }
`;
const name = parser.getInstancePropertyName();
expect(name).to.equal('_translateService');
});*/
it('should extract strings in TranslateService\'s get() method', () => {
const contents = `
@Component({ })