Skip to content

Commit

Permalink
Reproduce 1743
Browse files Browse the repository at this point in the history
  • Loading branch information
mvuksano committed Jun 4, 2015
1 parent efab76d commit 86f026e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
58 changes: 58 additions & 0 deletions test/unit/polymer-dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,64 @@

<x-redistribute-a-b></x-redistribute-a-b>

<dom-module id="x-containing-elem">
<template>
<content></content>
</template>
<script>
Polymer({
is: 'x-containing-elem',
properties: {
logger: {type: Array, notify: true}
},
attached: function() {
this.logger && this.logger.push('x-containing-elem')
}
});
</script>
</dom-module>

<dom-module id="x-contained-elem">
<template>Attr1</template>
<script>
Polymer({
is: 'x-contained-elem',
properties: {
logger: {type: Array, notify: true}
},
attached: function() {
this.logger && this.logger.push('x-contained-elem')
}

});
</script>
</dom-module>

<dom-module id="x-logger">
<template>
<x-containing-elem logger="{{logs}}">
<x-contained-elem logger="{{logs}}"></x-contained-elem>
</x-containing-elem>
</template>
<script>
Polymer({
is: 'x-logger',
properties: {
logs: {
type: Array,
notify: true,
value: function() {
return [];
}
}
}
});
</script>
</dom-module>

<x-logger>
</x-logger>

<script src="polymer-dom.js"></script>

</body>
Expand Down
7 changes: 6 additions & 1 deletion test/unit/polymer-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,17 @@ suite('Polymer.dom', function() {
assert.equal(Polymer.dom(c).getDestinationInsertionPoints()[0], ip$[1], 'child not distributed based on host attribute');
c.foo = true;
Polymer.dom.flush();
assert.equal(Polymer.dom(c).getDestinationInsertionPoints()[0], ip$[0], 'child not distributed based on reflecting attribute')
assert.equal(Polymer.dom(c).getDestinationInsertionPoints()[0], ip$[0], 'child not distributed based on reflecting attribute');
c.foo = false;
Polymer.dom.flush();
assert.equal(Polymer.dom(c).getDestinationInsertionPoints()[0], ip$[1], 'child not distributed based on reflecting attribute')
});

test.only('attach should be called first on child and then on parent', function() {
var e = document.querySelector('x-logger');
assert.equal(e.logs.toString(), ['x-contained-elem', 'x-containing-elem'].toString())
});

test('within a host setting hostAttributes/reflecting properties provokes distribution', function() {
// TODO(sorvell): disabling this test failure until it can be diagnosed
// filed as issue #1595
Expand Down

0 comments on commit 86f026e

Please sign in to comment.