/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import {MyElement} from '../my-element.js';
import {fixture, html} from '@open-wc/testing';
const assert = chai.assert;
suite('my-element', () => {
test('is defined', () => {
const el = document.createElement('my-element');
assert.instanceOf(el, MyElement);
});
test('renders with default values', async () => {
const el = await fixture(html``);
assert.shadowDom.equal(
el,
`
Hello, World!
`
);
});
test('renders with a set name', async () => {
const el = await fixture(html``);
assert.shadowDom.equal(
el,
`
Hello, Test!
`
);
});
test('handles a click', async () => {
const el = (await fixture(html``)) as MyElement;
const button = el.shadowRoot!.querySelector('button')!;
button.click();
await el.updateComplete;
assert.shadowDom.equal(
el,
`
Hello, World!
`
);
});
test('styling applied', async () => {
const el = (await fixture(html``)) as MyElement;
await el.updateComplete;
assert.equal(getComputedStyle(el).paddingTop, '16px');
});
});