Created
December 17, 2022 16:01
-
-
Save bobbyg603/c06130f9c8b0b42e465e255b0a327291 to your computer and use it in GitHub Desktop.
How to Build a Web Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MediumCardBodyElement } from '../src'; | |
import { fixture, assert } from '@open-wc/testing'; | |
import { html } from 'lit/static-html.js'; | |
suite('medium-card-body', () => { | |
test('is defined', () => { | |
const el = document.createElement('medium-card-body'); | |
assert.instanceOf(el, MediumCardBodyElement); | |
}); | |
test('renders with card body with body content', async () => { | |
const body = '🧍'; | |
const el = await fixture(html`<medium-card-body .body="${body}"></medium-card-body>`); | |
assert.shadowDom.equal( | |
el, | |
body | |
); | |
}); | |
test('renders card with color from css variable', async () => { | |
const color = 'rgb(0, 128, 0)'; | |
const style = `--medium-body-color: ${color}`; | |
const el = (await fixture(html`<medium-card-body style="${style}"></medium-card-body>`)) as MediumCardBodyElement; | |
await el.updateComplete; | |
assert.equal(getComputedStyle(el).color, color); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment