From 7f4876445ce759edb5804ddc00897e30899c029c Mon Sep 17 00:00:00 2001 From: Scott J Miles Date: Wed, 13 May 2015 11:21:04 -0700 Subject: [PATCH 1/3] propagate `negate` flag from `note` to `effect` --- src/standard/effects.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/standard/effects.html b/src/standard/effects.html index f16cc212a7..639f9f7fc2 100644 --- a/src/standard/effects.html +++ b/src/standard/effects.html @@ -173,7 +173,8 @@ args: sig.args, arg: arg, property: note.name, - index: index + index: index, + negate: note.negate }); }, this); }, From 36a3251117f05a2b9c2a69b9a5db9141bc885215 Mon Sep 17 00:00:00 2001 From: Scott J Miles Date: Wed, 13 May 2015 11:22:11 -0700 Subject: [PATCH 2/3] negate value in annotated computation if `effect.negate` is true (ultimately all effect-flag value mutations should be in one place, aka expressions) --- src/lib/bind/effects.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/bind/effects.html b/src/lib/bind/effects.html index 765928bfaf..4b2a494dcf 100644 --- a/src/lib/bind/effects.html +++ b/src/lib/bind/effects.html @@ -71,6 +71,9 @@ var computedHost = this._rootDataHost || this; var computedvalue = computedHost[effect.method].apply(computedHost, args); + if (effect.negate) { + computedvalue = !computedvalue; + } this._applyEffectValue(computedvalue, effect); } }, From 2efcb601a922aa3c5a6662aeed775f7f12b9f8db Mon Sep 17 00:00:00 2001 From: Scott J Miles Date: Wed, 13 May 2015 11:22:31 -0700 Subject: [PATCH 3/3] test for `{{!computed(prop)}}` --- test/unit/bind-elements.html | 1 + test/unit/bind.html | 1 + 2 files changed, 2 insertions(+) diff --git a/test/unit/bind-elements.html b/test/unit/bind-elements.html index b481671dbe..56ba8a61bf 100644 --- a/test/unit/bind-elements.html +++ b/test/unit/bind-elements.html @@ -9,6 +9,7 @@ computed-inline="{{computeInline(value,add, divide)}}" computed-inline2="{{computeInline(value, add,divide)}}" computedattribute$="{{computeInline(value, add,divide)}}" + neg-computed-inline="{{!computeInline(value,add,divide)}}" style$="{{boundStyle}}" data-id$="{{dataSetId}}" custom-event-value="{{customEventValue::custom}}" diff --git a/test/unit/bind.html b/test/unit/bind.html index 1b18c81bd3..6963bec6ff 100644 --- a/test/unit/bind.html +++ b/test/unit/bind.html @@ -160,6 +160,7 @@ el.divide = 3; assert.equal(el.$.boundChild.computedInline, 20, 'computedInline not correct'); assert.equal(el.$.boundChild.computedInline2, 20, 'computedInline2 not correct'); + assert.equal(el.$.boundChild.negComputedInline, false, 'negComputedInline not correct'); }); test('annotated computed attribute', function() {