Skip to content

Commit

Permalink
Dialogs: Add axe tests (#4991)
Browse files Browse the repository at this point in the history
  • Loading branch information
margaree authored Sep 19, 2024
1 parent cb63ea5 commit 2e978de
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 0 deletions.
37 changes: 37 additions & 0 deletions components/dialog/test/dialog-confirm.axe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import '../dialog-confirm.js';
import '../../button/button.js';
import { expect, fixture, html } from '@brightspace-ui/testing';

describe('d2l-dialog-confirm', () => {

it('closed', async() => {
const el = await fixture(html`<d2l-dialog-confirm></d2l-dialog-confirm>`);
await expect(el).to.be.accessible();
});

it('default with title-text', async() => {
const el = await fixture(html`<d2l-dialog-confirm opened title-text="My Dialog" text="My dialog content"></d2l-dialog-confirm>`);
await expect(el).to.be.accessible();
});

it('critical', async() => {
const el = await fixture(html`<d2l-dialog-cofirm opened title-text="My Dialog" critical text="My dialog content"></d2l-dialog-confirm>`);
await expect(el).to.be.accessible();
});

it('footer buttons', async() => {
const el = await fixture(html`
<d2l-dialog-cofirm title-text="Dialog Title" opened text="My dialog content">
<d2l-button slot="footer" primary data-dialog-action="done">Done</d2l-button>
<d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
</d2l-dialog-confirm>
`);
await expect(el).to.be.accessible();
});

it('no title-text', async() => {
const el = await fixture(html`<d2l-dialog-cofirm opened text="My dialog content"></d2l-dialog-confirm>`);
await expect(el).to.be.accessible();
});

});
44 changes: 44 additions & 0 deletions components/dialog/test/dialog-fullscreen.axe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import '../dialog-fullscreen.js';
import '../../button/button.js';
import { expect, fixture, html } from '@brightspace-ui/testing';

describe('d2l-dialog-fullscreen', () => {

it('closed', async() => {
const el = await fixture(html`<d2l-dialog-fullscreen></d2l-dialog-fullscreen>`);
await expect(el).to.be.accessible();
});

it('default with title-text', async() => {
const el = await fixture(html`<d2l-dialog-fullscreen opened title-text="My Dialog"></d2l-dialog-fullscreen>`);
await expect(el).to.be.accessible();
});

it('footer buttons', async() => {
const el = await fixture(html`
<d2l-dialog-fullscreen title-text="Dialog Title" opened>
<div>Some dialog content</div>
<d2l-button slot="footer" primary data-dialog-action="done">Done</d2l-button>
<d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
</d2l-dialog-fullscreen>
`);
await expect(el).to.be.accessible();
});

it.skip('no title-text', async() => {
const el = await fixture(html`<d2l-dialog-fullscreen opened>My content</d2l-dialog-fullscreen>`);
await expect(el).to.be.accessible();
});

it.skip('tall content', async() => {
const el = await fixture(html`
<d2l-dialog-fullscreen opened title-text="My Dialog">
<div style="overflow-y: scroll; height:200px;">
<div style="height: 10000px;">My content</div>
</div>
</d2l-dialog-fullscreen>
`);
await expect(el).to.be.accessible();
});

});
49 changes: 49 additions & 0 deletions components/dialog/test/dialog.axe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import '../dialog.js';
import '../../button/button.js';
import { expect, fixture, html } from '@brightspace-ui/testing';

describe('d2l-dialog', () => {

it('closed', async() => {
const el = await fixture(html`<d2l-dialog></d2l-dialog>`);
await expect(el).to.be.accessible();
});

it('default with title-text', async() => {
const el = await fixture(html`<d2l-dialog opened title-text="My Dialog"></d2l-dialog>`);
await expect(el).to.be.accessible();
});

it('describe-content', async() => {
const el = await fixture(html`<d2l-dialog opened title-text="My Dialog" describe-content>My content</d2l-dialog>`);
await expect(el).to.be.accessible();
});

it('footer buttons', async() => {
const el = await fixture(html`
<d2l-dialog title-text="Dialog Title" opened>
<div>Some dialog content</div>
<d2l-button slot="footer" primary data-dialog-action="done">Done</d2l-button>
<d2l-button slot="footer" data-dialog-action>Cancel</d2l-button>
</d2l-dialog>
`);
await expect(el).to.be.accessible();
});

it.skip('no title-text', async() => {
const el = await fixture(html`<d2l-dialog opened>My content</d2l-dialog>`);
await expect(el).to.be.accessible();
});

it.skip('tall content', async() => {
const el = await fixture(html`
<d2l-dialog opened title-text="My Dialog">
<div style="overflow-y: scroll; height:200px;">
<div style="height: 10000px;">My content</div>
</div>
</d2l-dialog>
`);
await expect(el).to.be.accessible();
});

});

0 comments on commit 2e978de

Please sign in to comment.