enable piped argument on function calls (#233)
This commit is contained in:
parent
acdffe0121
commit
17dfbbed84
@ -9,7 +9,8 @@ import {
|
|||||||
Binary,
|
Binary,
|
||||||
LiteralMap,
|
LiteralMap,
|
||||||
LiteralArray,
|
LiteralArray,
|
||||||
Interpolation
|
Interpolation,
|
||||||
|
MethodCall
|
||||||
} from '@angular/compiler';
|
} from '@angular/compiler';
|
||||||
|
|
||||||
import { ParserInterface } from './parser.interface';
|
import { ParserInterface } from './parser.interface';
|
||||||
@ -131,6 +132,10 @@ export class PipeParser implements ParserInterface {
|
|||||||
return this.getTranslatablesFromAsts(ast.expressions);
|
return this.getTranslatablesFromAsts(ast.expressions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ast instanceof MethodCall) {
|
||||||
|
return this.getTranslatablesFromAsts(ast.args);
|
||||||
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,4 +195,10 @@ describe('PipeParser', () => {
|
|||||||
const keys = parser.extract(contents, templateFilename).keys();
|
const keys = parser.extract(contents, templateFilename).keys();
|
||||||
expect(keys).to.deep.equal([]);
|
expect(keys).to.deep.equal([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should extract strings from piped arguments inside a function calls on templates', () => {
|
||||||
|
const contents = `{{ callMe('Hello' | translate, 'World' | translate ) }}`;
|
||||||
|
const keys = parser.extract(contents, templateFilename).keys();
|
||||||
|
expect(keys).to.deep.equal([`Hello`, `World`]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user