Fix props-after-create test

pull/5139/head
Christopher Mardell 5 years ago
parent 3c69b175be
commit 8be9968e40

@ -2,17 +2,22 @@ import * as assert from 'assert';
import CustomElement from './main.svelte';
export default async function (target) {
// initialize without options to simulate instantiation within HTML
const el = new CustomElement();
assert.equal(el.outerHTML, '<custom-element></custom-element>');
// const el = target.querySelector('custom-element');
el.items = ['a', 'b', 'c'];
const p0 = el.shadowRoot.querySelector('p');
assert.equal(el.shadowRoot, undefined);
// shouldn't be instantitated yet
assert.equal(p0, undefined);
el.items = ['a', 'b', 'c'];
const [p1, p2] = el.shadowRoot.querySelectorAll('p');
// simulate adding to DOM to trigger setup
el.connectedCallback();
const [p1, p2] = el.shadowRoot.querySelectorAll('p');
assert.equal(p1.textContent, '3 items');
assert.equal(p2.textContent, 'a, b, c');

Loading…
Cancel
Save