mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2295 from nazar-pc/method-parsing-fix
Fix for method parsing in computed binding
This commit is contained in:
commit
9c012a1a3b
@ -185,7 +185,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// method expressions are of the form: `name([arg1, arg2, .... argn])`
|
||||
_parseMethod: function(expression) {
|
||||
// tries to match valid javascript property names
|
||||
var m = expression.match(/([^\s]+)\((.*)\)/);
|
||||
var m = expression.match(/([^\s]+?)\((.*)\)/);
|
||||
if (m) {
|
||||
var sig = { method: m[1], static: true };
|
||||
if (m[2].trim()) {
|
||||
|
@ -43,6 +43,7 @@
|
||||
<span id="boundText">{{text}}</span>
|
||||
<span idtest id="{{boundId}}"></span>
|
||||
<s id="computedContent">{{computeFromTrickyLiterals(3, 'tricky\,\'zot\'')}}</s>
|
||||
<s id="computedContent2">{{computeFromTrickyLiterals("(",3)}}</s>
|
||||
<input id="boundInput" value="{{text::input}}">
|
||||
<div id="compound1">{{cpnd1}}{{cpnd2}}{{cpnd3.prop}}{{computeCompound(cpnd4, cpnd5, 'literal')}}</div>
|
||||
<div id="compound2">
|
||||
|
@ -174,6 +174,7 @@ suite('single-element binding effects', function() {
|
||||
assert.equal(el.$.boundChild.computedFromTrickyLiterals, '3tricky,\'zot\'', 'Wrong result from tricky literal arg computation');
|
||||
assert.equal(el.$.boundChild.computedFromTrickyLiterals2, '3tricky,\'zot\'', 'Wrong result from tricky literal arg computation');
|
||||
assert.equal(el.$.computedContent.textContent, '3tricky,\'zot\'', 'Wrong textContent from tricky literal arg computation');
|
||||
assert.equal(el.$.computedContent2.textContent, '(3', 'Wrong textContent from tricky literal arg computation');
|
||||
});
|
||||
|
||||
test('computed annotation with no args', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user