From 7027674081130ce33838b4eac3272111d68c8059 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Thu, 18 Dec 2014 11:39:37 +0100 Subject: [PATCH] fix(compiler): fix a typo in BIND_NAME_REGEXP --- modules/core/src/compiler/pipeline/property_binding_parser.js | 2 +- .../test/compiler/pipeline/property_binding_parser_spec.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/core/src/compiler/pipeline/property_binding_parser.js b/modules/core/src/compiler/pipeline/property_binding_parser.js index 32e05fef3a..3c1626c39e 100644 --- a/modules/core/src/compiler/pipeline/property_binding_parser.js +++ b/modules/core/src/compiler/pipeline/property_binding_parser.js @@ -11,7 +11,7 @@ import {CompileControl} from './compile_control'; import {interpolationToExpression} from './text_interpolation_parser'; // TODO(tbosch): Cannot make this const/final right now because of the transpiler... -var BIND_NAME_REGEXP = RegExpWrapper.create('^(?:(?:(bind)|(let)|(on))-(.+))|\\[([^\\]]+)\\]|\\(([^\\]]+)\\)'); +var BIND_NAME_REGEXP = RegExpWrapper.create('^(?:(?:(bind)|(let)|(on))-(.+))|\\[([^\\]]+)\\]|\\(([^\\)]+)\\)'); /** * Parses the property bindings on a single element. diff --git a/modules/core/test/compiler/pipeline/property_binding_parser_spec.js b/modules/core/test/compiler/pipeline/property_binding_parser_spec.js index 4c5f0da9fb..9c4f658e95 100644 --- a/modules/core/test/compiler/pipeline/property_binding_parser_spec.js +++ b/modules/core/test/compiler/pipeline/property_binding_parser_spec.js @@ -43,6 +43,10 @@ export function main() { it('should detect () syntax', () => { var results = createPipeline().process(createElement('
')); expect(MapWrapper.get(results[0].eventBindings, 'click').source).toEqual('b()'); + // "(click[])" is not an expected syntax and is only used to validate the regexp + results = createPipeline().process(createElement('
')); + expect(MapWrapper.get(results[0].eventBindings, 'click[]').source).toEqual('b()'); + }); it('should detect on- syntax', () => {