Skip to content

Commit

Permalink
Exclude attribute bindings from configuration. Fixes #3288.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Jan 13, 2016
1 parent 44232bd commit 246ea72
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/standard/configure.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@
for (var i=0, l=fx.length, x; (i<l) && (x=fx[i]); i++) {
// TODO(kschaaf): compound bindings (as well as computed effects)
// are excluded from top-down configure for now; to be revisited
if (x.kind === 'annotation' && !x.isCompound) {
if (x.kind === 'annotation' &&
x.effect.kind !== 'attribute' &&
!x.isCompound) {
var node = this._nodes[x.effect.index];
// seeding configuration only
if (node._configValue) {
Expand Down
5 changes: 4 additions & 1 deletion test/unit/configure-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

<dom-module id="x-configure-host">
<template>
<x-configure-child id="child" content="{{content}}" object="{{object.goo}}"></x-configure-child>
<x-configure-child id="child" content="{{content}}" object="{{object.goo}}" attr$="{{attrValue}}"></x-configure-child>
</template>
<script>
Polymer({
Expand Down Expand Up @@ -156,6 +156,9 @@
},
stomp: {
value: 5
},
attrValue: {
value: 'attrValue'
}
}

Expand Down
12 changes: 9 additions & 3 deletions test/unit/configure.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

<x-configure-value content="attr" object='{"foo": "obj-attr"}'></x-configure-value>

<x-configure-host></x-configure-host>
<x-configure-host></x-configure-host>

<x-configure-host content="attr"></x-configure-host>
<x-configure-host content="attr"></x-configure-host>

<script>

Expand Down Expand Up @@ -53,7 +53,7 @@

test('value set in properties initializes correctly', function() {
var e = document.querySelector('x-configure-value');
testConfigure(e, 'default', 'obj-default');
testConfigure(e, 'default', 'obj-default');
});

test('attribute overrides value set in properties', function() {
Expand Down Expand Up @@ -81,6 +81,12 @@
assert.equal(e.readOnly, 'default');
});

test('properties for attribute bindings not configured', function() {
var e = document.querySelector('x-configure-host');
assert.equal(e.$.child.getAttribute('attr'), 'attrValue');
assert.equal(e.$.child.attr, undefined);
});

});

</script>
Expand Down

0 comments on commit 246ea72

Please sign in to comment.