test: component/spinner (#556)

- covers accessibility
- provides explainer for aria-busy and aria-live tags.
pull/557/head
Christos Hrousis 2021-10-05 23:53:28 +11:00 zatwierdzone przez GitHub
rodzic 5e28d1131a
commit a75a71994a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 25 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,25 @@
import { expect, fixture, html } from '@open-wc/testing';
import '../../../dist/shoelace.js';
import type SlSpinner from './spinner';
describe('<sl-spinner>', () => {
let el: SlSpinner;
describe('when provided no parameters', () => {
before(async () => {
el = await fixture<SlSpinner>(html` <sl-spinner></sl-spinner> `);
});
it('should render a component that passes accessibility test.', async () => {
await expect(el).to.be.accessible();
});
it('should defer updates to screen reader users via aria-live="polite".', async () => {
// https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions
const base = el.shadowRoot?.querySelector('[part="base"]') as SVGElement;
await expect(base).have.attribute('aria-busy', 'true');
await expect(base).have.attribute('aria-live', 'polite');
});
});
});