kopia lustrzana https://github.com/shoelace-style/shoelace
testing: components/skeleton (#951)
* add tests for SlSkeleton * check base aria-properties toopull/979/head
rodzic
1301934796
commit
3b4d0652c4
|
@ -0,0 +1,34 @@
|
|||
import { expect, fixture, html } from '@open-wc/testing';
|
||||
import type SlSkeleton from './skeleton';
|
||||
|
||||
describe('<sl-skeleton>', () => {
|
||||
it('should render default skeleton', async () => {
|
||||
const el = await fixture<SlSkeleton>(html` <sl-skeleton></sl-skeleton> `);
|
||||
|
||||
await expect(el).to.be.accessible();
|
||||
|
||||
const base = el.shadowRoot!.querySelector<HTMLElement>('[part="base"]')!;
|
||||
const indicator = el.shadowRoot!.querySelector<HTMLElement>('[part="indicator"]')!;
|
||||
|
||||
expect(base.getAttribute('class')).to.equal(' skeleton ');
|
||||
expect(base.getAttribute('aria-busy')).to.equal('true');
|
||||
expect(base.getAttribute('aria-live')).to.equal('polite');
|
||||
expect(indicator.getAttribute('class')).to.equal('skeleton__indicator');
|
||||
});
|
||||
|
||||
it('should set pulse effect by attribute', async () => {
|
||||
const el = await fixture<SlSkeleton>(html` <sl-skeleton effect="pulse"></sl-skeleton> `);
|
||||
|
||||
const base = el.shadowRoot!.querySelector<HTMLElement>('[part="base"]')!;
|
||||
|
||||
expect(base.getAttribute('class')).to.equal(' skeleton skeleton--pulse ');
|
||||
});
|
||||
|
||||
it('should set sheen effect by attribute', async () => {
|
||||
const el = await fixture<SlSkeleton>(html` <sl-skeleton effect="sheen"></sl-skeleton> `);
|
||||
|
||||
const base = el.shadowRoot!.querySelector<HTMLElement>('[part="base"]')!;
|
||||
|
||||
expect(base.getAttribute('class')).to.equal(' skeleton skeleton--sheen ');
|
||||
});
|
||||
});
|
Ładowanie…
Reference in New Issue