diff --git a/polymer.html b/polymer.html index bc5517c3..3e7d6a61 100644 --- a/polymer.html +++ b/polymer.html @@ -14,7 +14,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN - + diff --git a/src/lib/bind/effects.html b/src/lib/bind/effects.html index 4b2a494d..c1ca8661 100644 --- a/src/lib/bind/effects.html +++ b/src/lib/bind/effects.html @@ -86,8 +86,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN for (var i=0, l=args.length; i 1 && v === undefined) { return; } @@ -95,7 +100,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN // Only send the actual path changed info if the change that // caused the observer to run matched the wildcard var baseChanged = (name.indexOf(path + '.') === 0); - var matches = (effect.arg.name.indexOf(name) === 0 && !baseChanged); + var matches = (effect.trigger.name.indexOf(name) === 0 && !baseChanged); values[i] = { path: matches ? path : name, value: matches ? value : v, diff --git a/src/standard/configure.html b/src/standard/configure.html index 78020b74..ce957ecb 100644 --- a/src/standard/configure.html +++ b/src/standard/configure.html @@ -67,6 +67,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN // configure: returns user supplied default property values // combines with _config to create final property values _configure: function() { + // some annotation data needs to be handed from host to client + // e.g. hand template content stored in notes to children as part of + // configure flow so templates have their content at ready time this._configureAnnotationReferences(); // get individual default values from property configs var config = {}; @@ -132,6 +135,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN // Override polymer-mini thunk _afterClientsReady: function() { + // process static effects, e.g. computations that have only literal arguments + this._executeStaticEffects(); this._applyConfig(this._config); this._flushHandlers(); }, diff --git a/src/standard/effects.html b/src/standard/effectBuilder.html similarity index 67% rename from src/standard/effects.html rename to src/standard/effectBuilder.html index 5061ea8b..bfc939fe 100644 --- a/src/standard/effects.html +++ b/src/standard/effectBuilder.html @@ -1,214 +1,277 @@ - - - - - - + + + + + + diff --git a/src/standard/notify-path.html b/src/standard/notify-path.html index 1c4cce67..72082f35 100644 --- a/src/standard/notify-path.html +++ b/src/standard/notify-path.html @@ -212,10 +212,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }, _pathMatchesEffect: function(path, effect) { - var effectArg = effect.arg.name; + var effectArg = effect.trigger.name; return (effectArg == path) || (effectArg.indexOf(path + '.') === 0) || - (effect.arg.wildcard && path.indexOf(effectArg) === 0); + (effect.trigger.wildcard && path.indexOf(effectArg) === 0); }, linkPaths: function(to, from) { diff --git a/test/unit/bind-elements.html b/test/unit/bind-elements.html index 17a8579c..0f0693a7 100644 --- a/test/unit/bind-elements.html +++ b/test/unit/bind-elements.html @@ -13,11 +13,18 @@ style$="{{boundStyle}}" data-id$="{{dataSetId}}" custom-event-value="{{customEventValue::custom}}" - custom-event-object-value="{{customEventObject.value::change}}"> + custom-event-object-value="{{customEventObject.value::change}}" + computed-from-mixed-literals='{{computeFromLiterals(3, "foo", bool)}}' + computed-from-pure-literals='{{computeFromLiterals( 3, "foo")}}' + computed-from-tricky-literals="{{computeFromTrickyLiterals(3, 'tricky\,\'zot\'')}}" + computed-from-tricky-literals2='{{computeFromTrickyLiterals(3,"tricky\,'zot'" )}}' + computed-from-no-args="{{computeFromNoArgs( )}}" + > Test {{text}} + {{computeFromTrickyLiterals(3, 'tricky\,\'zot\'')}} diff --git a/test/unit/bind.html b/test/unit/bind.html index f221931e..cba71e4a 100644 --- a/test/unit/bind.html +++ b/test/unit/bind.html @@ -138,6 +138,19 @@ suite('single-element binding effects', function() { assert.equal(el.observerCounts.computedFromMultipleValuesChanged, 1, 'observer not called'); }); + test('computed annotation with literals', function() { + el.bool = true; + assert.equal(el.$.boundChild.computedFromMixedLiterals, '3foo', 'Wrong result from mixed literal arg computation'); + assert.equal(el.$.boundChild.computedFromPureLiterals, '3foo', 'Wrong result from pure literal arg computation'); + 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'); + }); + + test('computed annotation with no args', function() { + assert.equal(el.$.boundChild.computedFromNoArgs, 'no args!', 'Wrong content when computed has no args'); + }); + test('no read-only observer called with assignment', function() { el.readolyvalue = 46; assert.equal(el.observerCounts.readonlyvalueChanged, 0, 'observer should not be called for readOnly prop assignment');