Skip to content

Commit

Permalink
Test on native shadow DOM also.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Sep 22, 2016
1 parent cbae058 commit 11afc1f
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions test/unit/polymer-dom-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,8 @@
assert.equal(dist.$.fooIP.getAttribute('select'), '[slot=\'foo\']');
assert.equal(dist.$.defaultIP.localName, 'content');
assert.equal(dist.$.defaultIP.getAttribute('select'), ':not([slot])');
if (usingShady) {
assert.equal(dist.$.foo.firstElementChild.textContent, 'fallback for foo');
assert.equal(dist.$.default.firstElementChild.textContent, 'fallback for default');
}
assert.equal(Polymer.dom(dist.$.fooIP).getDistributedNodes()[0].textContent, 'fallback for foo');
assert.equal(Polymer.dom(dist.$.defaultIP).getDistributedNodes()[0].textContent, 'fallback for default');
// Distribute div
var frag = document.createDocumentFragment();
var foo1 = frag.appendChild(document.createElement('div'));
Expand All @@ -371,24 +369,20 @@
foo2.setAttribute('slot', 'foo');
Polymer.dom(dist).appendChild(frag);
Polymer.dom.flush();
if (usingShady) {
assert.equal(dist.$.foo.children[0], foo1);
assert.equal(dist.$.foo.children[1], foo2);
assert.equal(dist.$.default.children[0], default1);
assert.equal(dist.$.default.children[1], default2);
}
assert.equal(Polymer.dom(dist.$.fooIP).getDistributedNodes()[0], foo1);
assert.equal(Polymer.dom(dist.$.fooIP).getDistributedNodes()[1], foo2);
assert.equal(Polymer.dom(dist.$.defaultIP).getDistributedNodes()[0], default1);
assert.equal(Polymer.dom(dist.$.defaultIP).getDistributedNodes()[1], default2);
// Remove
Polymer.dom(dist).removeChild(foo1);
Polymer.dom(dist).removeChild(foo2);
Polymer.dom(dist).removeChild(default1);
Polymer.dom(dist).removeChild(default2);
Polymer.dom.flush();
if (usingShady) {
assert.equal(dist.$.foo.children[0].textContent, 'fallback for foo');
assert.equal(dist.$.foo.children[1], null);
assert.equal(dist.$.default.children[0].textContent, 'fallback for default');
assert.equal(dist.$.default.children[1], null);
}
assert.equal(Polymer.dom(dist.$.fooIP).getDistributedNodes()[0].textContent, 'fallback for foo');
assert.equal(Polymer.dom(dist.$.fooIP).getDistributedNodes()[1], null);
assert.equal(Polymer.dom(dist.$.defaultIP).getDistributedNodes()[0].textContent, 'fallback for default');
assert.equal(Polymer.dom(dist.$.defaultIP).getDistributedNodes()[1], null);
document.body.removeChild(dist);
});

Expand Down

0 comments on commit 11afc1f

Please sign in to comment.