-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoscd-component.spec.ts
41 lines (32 loc) · 1.13 KB
/
oscd-component.spec.ts
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
40
41
import { expect, fixture } from '@open-wc/testing';
import { html } from 'lit';
import './oscd-component.js';
import type { OscdComponent } from './oscd-component.js';
describe('OscdComponent', () => {
it('has a default title "Hey there" and counter 5', async () => {
const el = await fixture<OscdComponent>(
html`<oscd-component></oscd-component>`
);
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<OscdComponent>(
html`<oscd-component></oscd-component>`
);
el.shadowRoot!.querySelector('button')!.click();
expect(el.counter).to.equal(6);
});
it('can override the title via attribute', async () => {
const el = await fixture<OscdComponent>(
html`<oscd-component title="attribute title"></oscd-component>`
);
expect(el.title).to.equal('attribute title');
});
it('passes the a11y audit', async () => {
const el = await fixture<OscdComponent>(
html`<oscd-component></oscd-component>`
);
await expect(el).shadowDom.to.be.accessible();
});
});