Skip to content

Commit 06b5b05

Browse files
committed
test: add a11y test for package header
1 parent 0bed08a commit 06b5b05

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

app/pages/package/[[org]]/[name].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ onMounted(() => {
5555
checkHeaderPosition()
5656
})
5757
58-
const { packageName, requestedVersion, orgName } = usePackageRoute()
58+
const { packageName, requestedVersion } = usePackageRoute()
5959
6060
const { data: resolvedVersion, status: resolvedStatus } = await useResolvedVersion(
6161
packageName,

test/nuxt/a11y.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ import {
171171
PackageCompatibility,
172172
PackageDependencies,
173173
PackageDeprecatedTree,
174+
PackageHeader,
174175
PackageInstallScripts,
175176
PackageKeywords,
176177
PackageList,
@@ -725,6 +726,36 @@ describe('component accessibility audits', () => {
725726
})
726727
})
727728

729+
describe('PackageHeader', () => {
730+
it('should have no accessibility violations', async () => {
731+
const component = await mountSuspended(PackageHeader, {
732+
props: {
733+
pkg: { name: 'vue' },
734+
resolvedVersion: '3.5.0',
735+
displayVersion: {
736+
_id: '1234567890',
737+
_npmVersion: '3.5.0',
738+
name: 'vue',
739+
version: '3.5.0',
740+
dist: {
741+
shasum: '1234567890',
742+
signatures: [],
743+
tarball: 'https://npmx.dev/package/vue/tarball',
744+
},
745+
},
746+
latestVersion: { version: '3.5.0', tags: [] },
747+
provenanceData: null,
748+
provenanceStatus: 'idle',
749+
docsLink: null,
750+
codeLink: null,
751+
isBinaryOnly: false,
752+
},
753+
})
754+
const results = await runAxe(component)
755+
expect(results.violations).toEqual([])
756+
})
757+
})
758+
728759
// Note: PackageWeeklyDownloadStats tests are skipped because vue-data-ui VueUiSparkline
729760
// component has issues in the test environment (requires DOM measurements that aren't
730761
// available during SSR-like test mounting).

0 commit comments

Comments
 (0)