Import upstream changes (949a54677748a1f83ec4d166bd40e244de3afda7)
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
import {MyElement} from '../my-element.js';
|
import {MyElement} from '../my-element.js';
|
||||||
|
|
||||||
import {fixture, assert} from '@open-wc/testing';
|
import {fixture, assert} from '@open-wc/testing';
|
||||||
|
import {UncompiledTemplateResult} from 'lit';
|
||||||
import {html} from 'lit/static-html.js';
|
import {html} from 'lit/static-html.js';
|
||||||
|
|
||||||
suite('my-element', () => {
|
suite('my-element', () => {
|
||||||
@@ -16,7 +17,9 @@ suite('my-element', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('renders with default values', async () => {
|
test('renders with default values', async () => {
|
||||||
const el = await fixture(html`<my-element></my-element>`);
|
const el = await fixture(
|
||||||
|
html`<my-element></my-element>` as UncompiledTemplateResult
|
||||||
|
);
|
||||||
assert.shadowDom.equal(
|
assert.shadowDom.equal(
|
||||||
el,
|
el,
|
||||||
`
|
`
|
||||||
@@ -28,7 +31,9 @@ suite('my-element', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('renders with a set name', async () => {
|
test('renders with a set name', async () => {
|
||||||
const el = await fixture(html`<my-element name="Test"></my-element>`);
|
const el = await fixture(
|
||||||
|
html`<my-element name="Test"></my-element>` as UncompiledTemplateResult
|
||||||
|
);
|
||||||
assert.shadowDom.equal(
|
assert.shadowDom.equal(
|
||||||
el,
|
el,
|
||||||
`
|
`
|
||||||
@@ -40,7 +45,9 @@ suite('my-element', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('handles a click', async () => {
|
test('handles a click', async () => {
|
||||||
const el = (await fixture(html`<my-element></my-element>`)) as MyElement;
|
const el = (await fixture(
|
||||||
|
html`<my-element></my-element>` as UncompiledTemplateResult
|
||||||
|
)) as MyElement;
|
||||||
const button = el.shadowRoot!.querySelector('button')!;
|
const button = el.shadowRoot!.querySelector('button')!;
|
||||||
button.click();
|
button.click();
|
||||||
await el.updateComplete;
|
await el.updateComplete;
|
||||||
@@ -55,7 +62,9 @@ suite('my-element', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('styling applied', async () => {
|
test('styling applied', async () => {
|
||||||
const el = (await fixture(html`<my-element></my-element>`)) as MyElement;
|
const el = (await fixture(
|
||||||
|
html`<my-element></my-element>` as UncompiledTemplateResult
|
||||||
|
)) as MyElement;
|
||||||
await el.updateComplete;
|
await el.updateComplete;
|
||||||
assert.equal(getComputedStyle(el).paddingTop, '16px');
|
assert.equal(getComputedStyle(el).paddingTop, '16px');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user