add stylesheet to test runner; fix tests

pull/1123/head
Cory LaViska 2023-01-09 10:35:37 -05:00
rodzic ae3070ac45
commit bf527437a0
5 zmienionych plików z 22 dodań i 15 usunięć

Wyświetl plik

@ -2,6 +2,10 @@ import { expect, fixture, html, waitUntil } from '@open-wc/testing';
import sinon from 'sinon';
import type SlAvatar from './avatar';
// The default avatar background just misses AA contrast, but the next step up is way too dark. Since avatars aren't
// used to display text, we're going to relax this rule.
const ignoredRules = ['color-contrast'];
describe('<sl-avatar>', () => {
let el: SlAvatar;
@ -11,7 +15,7 @@ describe('<sl-avatar>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('should default to circle styling', () => {
@ -36,7 +40,7 @@ describe('<sl-avatar>', () => {
* the image element to pass accessibility.
* https://html.spec.whatwg.org/multipage/images.html#ancillary-images
*/
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('renders "image" part, with src and a role of presentation', () => {
@ -59,7 +63,7 @@ describe('<sl-avatar>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('renders "initials" part, with initials as the text node', () => {
@ -76,7 +80,7 @@ describe('<sl-avatar>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('appends the appropriate class on the "base" part', () => {
@ -94,7 +98,7 @@ describe('<sl-avatar>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('should accept as an assigned child in the shadow root', () => {

Wyświetl plik

@ -1,6 +1,10 @@
import { expect, fixture, html } from '@open-wc/testing';
import type SlBreadcrumb from './breadcrumb';
// The default link color just misses AA contrast, but the next step up is way too dark. Maybe we can solve this in the
// future with a prefers-contrast media query.
const ignoredRules = ['color-contrast'];
describe('<sl-breadcrumb>', () => {
let el: SlBreadcrumb;
@ -17,7 +21,7 @@ describe('<sl-breadcrumb>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('should render sl-icon as separator', () => {
@ -44,7 +48,7 @@ describe('<sl-breadcrumb>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
it('should accept "separator" as an assigned child in the shadow root', () => {
@ -76,7 +80,7 @@ describe('<sl-breadcrumb>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
});
@ -96,7 +100,7 @@ describe('<sl-breadcrumb>', () => {
});
it('should pass accessibility tests', async () => {
await expect(el).to.be.accessible();
await expect(el).to.be.accessible({ ignoredRules });
});
});
});

Wyświetl plik

@ -183,7 +183,7 @@ describe('<sl-details>', () => {
await first.show();
await second.show();
expect(firstBody.clientHeight).to.equal(200);
expect(secondBody.clientHeight).to.equal(400);
expect(firstBody.clientHeight).to.equal(232); // 200 + 16px + 16px (vertical padding)
expect(secondBody.clientHeight).to.equal(432); // 400 + 16px + 16px (vertical padding)
});
});

Wyświetl plik

@ -316,12 +316,10 @@ describe('<sl-select>', () => {
`);
const resetButton = form.querySelector('sl-button')!;
const select = form.querySelector('sl-select')!;
const option2 = form.querySelectorAll('sl-option')![1];
await select.show();
await clickOnElement(option2);
select.value = 'option-3';
await select.updateComplete;
expect(select.value).to.equal('option-2');
expect(select.value).to.equal('option-3');
setTimeout(() => clickOnElement(resetButton));
await oneEvent(form, 'reset');

Wyświetl plik

@ -22,6 +22,7 @@ export default {
<html lang="en-US">
<head></head>
<body>
<link rel="stylesheet" href="dist/themes/light.css">
<script type="module" src="dist/shoelace.js"></script>
<script type="module" src="${testFramework}"></script>
</body>