Skip to content

Commit

Permalink
Fix testing issues with latest webcomponentsjs
Browse files Browse the repository at this point in the history
* querySelectorAll now polyfills an NodeList so coerce to Array when doing `deepEquals`
* when testing noPatch, add workaround for webcomponents/polyfills#250.
  • Loading branch information
Steven Orvell committed Jan 22, 2020
1 parent 700c2b0 commit 61a14c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion test/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
'unit/dom-bind.html',
'unit/array-selector.html',
'unit/polymer-dom.html',
'unit/polymer-dom-nopatch.html',
// Forced to `noPatch` here to workaround
// https://github.com/webcomponents/polyfills/issues/250.
'unit/polymer-dom-nopatch.html?wc-noPatch=true',
'unit/polymer-dom-observeNodes.html',
'unit/flattened-nodes-observer.html',
// TODO: substitute for equivalent es6 import tests
Expand Down
12 changes: 6 additions & 6 deletions test/unit/shady.html
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@
child.shadowRoot.innerHTML = '<slot></slot><span id="sub"></span>';
var childLocalSub = child.shadowRoot.lastChild;
ShadyDOM.flush();
assert.deepEqual(host.root.querySelectorAll('span#main'), [hostLocalMain]);
assert.deepEqual(host.root.querySelectorAll('div#sub'), [childLightSub]);
assert.deepEqual(child.root.querySelectorAll('span#sub'), [childLocalSub]);
assert.deepEqual(Array.from(host.root.querySelectorAll('span#main')), [hostLocalMain]);
assert.deepEqual(Array.from(host.root.querySelectorAll('div#sub')), [childLightSub]);
assert.deepEqual(Array.from(child.root.querySelectorAll('span#sub')), [childLocalSub]);
});

test('querySelectorAll (light dom)', function() {
Expand All @@ -396,9 +396,9 @@
var childLightSub = getComposedChildAtIndex(child, 100) ;
child.shadowRoot.innerHTML = '<slot></slot><span id="sub"></span>';
ShadyDOM.flush();
assert.deepEqual(host.querySelectorAll('div#main'), [hostLightMain]);
assert.deepEqual(host.querySelectorAll('#sub'), []);
assert.deepEqual(child.querySelectorAll('div#sub'), [childLightSub]);
assert.deepEqual(Array.from(host.querySelectorAll('div#main')), [hostLightMain]);
assert.deepEqual(Array.from(host.querySelectorAll('#sub')), []);
assert.deepEqual(Array.from(child.querySelectorAll('div#sub')), [childLightSub]);
});

});
Expand Down

0 comments on commit 61a14c1

Please sign in to comment.