Skip to content
Browse files

Support for negative numbers in computed bindings

  • Loading branch information...
1 parent a42ca09 commit fc53f50c3ed4ea71699121dacf38482e6a311f97 @nazar-pc nazar-pc committed
Showing with 11 additions and 2 deletions.
  1. +1 −0 src/standard/effectBuilder.html
  2. +4 −0 test/unit/bind-elements.html
  3. +6 −2 test/unit/bind.html
View
1 src/standard/effectBuilder.html
@@ -221,6 +221,7 @@
a.literal = true;
break;
case '#':
+ case '-':
a.value = Number(arg);
a.literal = true;
break;
View
4 test/unit/bind-elements.html
@@ -11,6 +11,7 @@
computed-inline2="{{computeInline(value, add,divide)}}"
computedattribute$="{{computeInline(value, add,divide)}}"
neg-computed-inline="{{!computeInline(value,add,divide)}}"
+ computed-negative-number="{{computeNegativeNumber(-1)}}"
style$="{{boundStyle}}"
data-id$="{{dataSetId}}"
custom-event-value="{{customEventValue::custom}}"
@@ -232,6 +233,9 @@
},
computeFromNoArgs: function() {
return 'no args!';
+ },
+ computeNegativeNumber: function (num) {
+ return num;
}
});
</script>
View
8 test/unit/bind.html
@@ -262,6 +262,10 @@
assert.equal(el.observerCounts.customEventObjectValueChanged, 1, 'custom bound path observer not called');
});
+ test('computed property with negative number', function() {
+ assert.equal(el.$.boundChild.computedNegativeNumber, -1);
+ });
+
});
</script>
@@ -684,14 +688,14 @@
<script>
suite('binding corner cases', function() {
-
+
// IE can create adjacent text nodes that split bindings; this test
// ensures the code that addresses this is functional
test('text binding after entity', function() {
var el = document.createElement('x-entity-and-binding');
assert.equal(el.$.binding.textContent, 'binding');
});
-
+
});
</script>

0 comments on commit fc53f50

Please sign in to comment.
Something went wrong with that request. Please try again.