Skip to content

Instantly share code, notes, and snippets.

@bobbyg603
Created December 18, 2022 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobbyg603/847f1b4eca80e13d3b7ef3c8f69c06d4 to your computer and use it in GitHub Desktop.
Save bobbyg603/847f1b4eca80e13d3b7ef3c8f69c06d4 to your computer and use it in GitHub Desktop.
How to Build a Web Component
test('sets all card properties', async () => {
const el = await fixture(html`<medium-feed .url="${url}"></medium-feed>`) as MediumFeedElement;
await el.updateComplete;
await waitUntil(
() => el.shadowRoot?.querySelectorAll('medium-card').length === cards,
'Element did not render children',
);
const firstCard = el.shadowRoot?.querySelector('medium-card') as MediumCardElement;
assert.equal(firstCard?.thumbnail, article.thumbnail);
assert.equal(firstCard?.header, article.title);
assert.equal(firstCard?.subheader, article.author);
assert.isNotEmpty(firstCard?.body);
assert.isNotEmpty(firstCard?.footer);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment