Skip to content

Commit

Permalink
Moved check earlier.
Browse files Browse the repository at this point in the history
Added test for negative literal.
  • Loading branch information
nazar-pc committed Aug 18, 2015
1 parent fc53f50 commit 1a87ab4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/standard/effectBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '#';
}
Expand All @@ -221,7 +224,6 @@
a.literal = true;
break;
case '#':
case '-':
a.value = Number(arg);
a.literal = true;
break;
Expand Down
1 change: 1 addition & 0 deletions test/unit/bind-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down
4 changes: 4 additions & 0 deletions test/unit/bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@
assert.equal(el.$.boundChild.computedNegativeNumber, -1);
});

test('computed property with negative literal', function() {
assert.equal(el.$.boundChild.computedNegativeLiteral, undefined);
});

});

</script>
Expand Down

0 comments on commit 1a87ab4

Please sign in to comment.