fix(compiler): fix interpolation regexp

- Fix the interpolation regexp to match newline characters (i.e. `\n` and `\r`)

Closes #6056
This commit is contained in:
Wesley Cho 2015-12-21 11:32:23 -05:00 committed by Alex Eagle
parent 995a9e0cf8
commit 9b0e10e9a7
2 changed files with 5 additions and 1 deletions

View File

@ -49,7 +49,7 @@ import {
var _implicitReceiver = new ImplicitReceiver();
// TODO(tbosch): Cannot make this const/final right now because of the transpiler...
var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g;
var INTERPOLATION_REGEXP = /\{\{([\s\S]*?)\}\}/g;
class ParseException extends BaseException {
constructor(message: string, input: string, errLocation: string, ctxLocation?: any) {

View File

@ -421,6 +421,10 @@ export function main() {
it('should parse conditional expression',
() => { checkInterpolation('{{ a < b ? a : b }}'); });
it('should parse expression with newline characters', () => {
checkInterpolation(`{{ 'foo' +\n 'bar' +\r 'baz' }}`, `{{ "foo" + "bar" + "baz" }}`);
});
});
describe("parseSimpleBinding", () => {