-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathmy-element.test.js
39 lines (30 loc) · 975 Bytes
/
my-element.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { html, fixture, expect } from '@open-wc/testing';
import '../my-element.js';
describe('MyElement', () => {
it('has a default title "Hey there" and counter 5', async () => {
const el = await fixture(html`
<my-element></my-element>
`);
expect(el.title).to.equal('Hey there');
expect(el.counter).to.equal(5);
});
it('increases the counter on button click', async () => {
const el = await fixture(html`
<my-element></my-element>
`);
el.shadowRoot.querySelector('button').click();
expect(el.counter).to.equal(6);
});
it('can override the title via attribute', async () => {
const el = await fixture(html`
<my-element title="attribute title"></my-element>
`);
expect(el.title).to.equal('attribute title');
});
it('passes the a11y audit', async () => {
const el = await fixture(html`
<my-element></my-element>
`);
await expect(el).shadowDom.to.be.accessible();
});
});