Skip to content

Commit 4df6684

Browse files
committed
test(a11y): add accessibility tests for AppPopover and PackageProvenanceSection
1 parent 8b37de5 commit 4df6684

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

test/nuxt/a11y.spec.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ afterEach(() => {
5757
import {
5858
AppFooter,
5959
AppHeader,
60+
AppPopover,
6061
UserAvatar,
6162
BuildEnvironment,
6263
CallToAction,
@@ -80,6 +81,7 @@ import {
8081
LoadingSpinner,
8182
PackageChartModal,
8283
PackageClaimPackageModal,
84+
PackageProvenanceSection,
8385
HeaderConnectorModal,
8486
OrgMembersPanel,
8587
OrgOperationsQueue,
@@ -211,6 +213,43 @@ describe('component accessibility audits', () => {
211213
})
212214
})
213215

216+
describe('AppPopover', () => {
217+
it('should have no accessibility violations when closed', async () => {
218+
const component = await mountSuspended(AppPopover, {
219+
slots: {
220+
default: '<button type="button">Trigger</button>',
221+
content: '<p>Popover content</p>',
222+
},
223+
})
224+
const results = await runAxe(component)
225+
expect(results.violations).toEqual([])
226+
})
227+
228+
it('should have no accessibility violations when open', async () => {
229+
const component = await mountSuspended(AppPopover, {
230+
slots: {
231+
default: '<button type="button">Trigger</button>',
232+
content: '<p>Popover content</p>',
233+
},
234+
})
235+
await component.find('.relative').trigger('focusin')
236+
const results = await runAxe(component)
237+
expect(results.violations).toEqual([])
238+
})
239+
240+
it('should have no accessibility violations with position prop', async () => {
241+
const component = await mountSuspended(AppPopover, {
242+
props: { position: 'top' },
243+
slots: {
244+
default: '<button type="button">Trigger</button>',
245+
content: '<p>Popover content</p>',
246+
},
247+
})
248+
const results = await runAxe(component)
249+
expect(results.violations).toEqual([])
250+
})
251+
})
252+
214253
describe('TooltipApp', () => {
215254
it('should have no accessibility violations', async () => {
216255
const component = await mountSuspended(TooltipApp, {
@@ -746,6 +785,40 @@ describe('component accessibility audits', () => {
746785
})
747786
})
748787

788+
describe('PackageProvenanceSection', () => {
789+
it('should have no accessibility violations with minimal details', async () => {
790+
const component = await mountSuspended(PackageProvenanceSection, {
791+
props: {
792+
details: {
793+
provider: 'github',
794+
providerLabel: 'GitHub Actions',
795+
},
796+
},
797+
})
798+
const results = await runAxe(component)
799+
expect(results.violations).toEqual([])
800+
})
801+
802+
it('should have no accessibility violations with full details', async () => {
803+
const component = await mountSuspended(PackageProvenanceSection, {
804+
props: {
805+
details: {
806+
provider: 'github',
807+
providerLabel: 'GitHub Actions',
808+
buildSummaryUrl: 'https://github.com/owner/repo/actions/runs/123',
809+
sourceCommitUrl: 'https://github.com/owner/repo/commit/abc123',
810+
sourceCommitSha: 'abc123def456',
811+
buildFileUrl: 'https://github.com/owner/repo/blob/main/.github/workflows/release.yml',
812+
buildFilePath: '.github/workflows/release.yml',
813+
publicLedgerUrl: 'https://search.sigstore.dev/example',
814+
},
815+
},
816+
})
817+
const results = await runAxe(component)
818+
expect(results.violations).toEqual([])
819+
})
820+
})
821+
749822
describe('OrgOperationsQueue', () => {
750823
it('should have no accessibility violations', async () => {
751824
const component = await mountSuspended(OrgOperationsQueue)

0 commit comments

Comments
 (0)