From 11afc1f351068c539b93d79d19c1854650b165d5 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 21 Sep 2016 17:23:38 -0700 Subject: [PATCH] Test on native shadow DOM also. --- test/unit/polymer-dom-content.html | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/test/unit/polymer-dom-content.html b/test/unit/polymer-dom-content.html index 1039cc2562..2a70eaeb9f 100644 --- a/test/unit/polymer-dom-content.html +++ b/test/unit/polymer-dom-content.html @@ -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')); @@ -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); });