From 1a87ab4c4ffee63e27f0567bb131a51afd1a2fc1 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 18 Aug 2015 20:11:22 +0200 Subject: [PATCH] Moved check earlier. Added test for negative literal. --- src/standard/effectBuilder.html | 4 +++- test/unit/bind-elements.html | 1 + test/unit/bind.html | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/standard/effectBuilder.html b/src/standard/effectBuilder.html index d8cb0e1487..4048a0ca57 100644 --- a/src/standard/effectBuilder.html +++ b/src/standard/effectBuilder.html @@ -211,6 +211,9 @@ }; // detect literal value (must be String or Number) var fc = arg[0]; + if (fc === '-') { + fc = arg[1]; + } if (fc >= '0' && fc <= '9') { fc = '#'; } @@ -221,7 +224,6 @@ a.literal = true; break; case '#': - case '-': a.value = Number(arg); a.literal = true; break; diff --git a/test/unit/bind-elements.html b/test/unit/bind-elements.html index 388320a6e2..250feae712 100644 --- a/test/unit/bind-elements.html +++ b/test/unit/bind-elements.html @@ -12,6 +12,7 @@ computedattribute$="{{computeInline(value, add,divide)}}" neg-computed-inline="{{!computeInline(value,add,divide)}}" computed-negative-number="{{computeNegativeNumber(-1)}}" + computed-negative-literal="{{computeNegativeNumber(-A)}}" style$="{{boundStyle}}" data-id$="{{dataSetId}}" custom-event-value="{{customEventValue::custom}}" diff --git a/test/unit/bind.html b/test/unit/bind.html index e37478f3bb..3a003841f4 100644 --- a/test/unit/bind.html +++ b/test/unit/bind.html @@ -266,6 +266,10 @@ assert.equal(el.$.boundChild.computedNegativeNumber, -1); }); + test('computed property with negative literal', function() { + assert.equal(el.$.boundChild.computedNegativeLiteral, undefined); + }); + });