2023-06-13 19:43:21 +00:00
|
|
|
import '../../../dist/shoelace.js';
|
2021-10-05 12:53:28 +00:00
|
|
|
import { expect, fixture, html } from '@open-wc/testing';
|
2023-12-08 17:30:31 +00:00
|
|
|
import type SlSpinner from './spinner.js';
|
2021-10-05 12:53:28 +00:00
|
|
|
|
|
|
|
describe('<sl-spinner>', () => {
|
|
|
|
describe('when provided no parameters', () => {
|
2022-03-08 22:34:17 +00:00
|
|
|
it('should pass accessibility tests', async () => {
|
2023-01-10 15:48:55 +00:00
|
|
|
const spinner = await fixture<SlSpinner>(html` <sl-spinner></sl-spinner> `);
|
|
|
|
await expect(spinner).to.be.accessible();
|
2021-10-05 12:53:28 +00:00
|
|
|
});
|
|
|
|
|
2023-01-10 15:48:55 +00:00
|
|
|
it('should have a role of "status".', async () => {
|
|
|
|
const spinner = await fixture<SlSpinner>(html` <sl-spinner></sl-spinner> `);
|
|
|
|
const base = spinner.shadowRoot!.querySelector('[part~="base"]')!;
|
2022-08-10 20:53:27 +00:00
|
|
|
expect(base).have.attribute('role', 'progressbar');
|
2021-10-05 12:53:28 +00:00
|
|
|
});
|
2023-01-10 15:48:55 +00:00
|
|
|
|
|
|
|
it('should use "transform: rotate(x)" instead of "rotate: x" when animating', async () => {
|
|
|
|
const spinner = await fixture<SlSpinner>(html` <sl-spinner></sl-spinner> `);
|
|
|
|
const indicator = spinner.shadowRoot!.querySelector('.spinner__indicator')!;
|
|
|
|
|
|
|
|
//
|
|
|
|
// This matrix is the computed value when using `transform: rotate(x)` on the indicator. When using `rotate: x`,
|
|
|
|
// it will be "none" instead.
|
|
|
|
//
|
|
|
|
// Related: https://github.com/shoelace-style/shoelace/issues/1121
|
|
|
|
//
|
|
|
|
expect(getComputedStyle(indicator).transform).to.equal('matrix(1, 0, 0, 1, 0, 0)');
|
|
|
|
});
|
2021-10-05 12:53:28 +00:00
|
|
|
});
|
|
|
|
});
|