Skip to content

Commit 40071d0

Browse files
committed
fix: add a11y tests for code components, fix type and lint issues
1 parent d9f13fe commit 40071d0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/nuxt/a11y.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ import {
146146
ChartPatternSlot,
147147
CodeDirectoryListing,
148148
CodeFileTree,
149+
CodeHeader,
149150
CodeMobileTreeDrawer,
151+
CodeSkeletonLoader,
150152
CodeViewer,
151153
CopyToClipboardButton,
152154
CollapsibleSection,
@@ -1158,6 +1160,36 @@ describe('component accessibility audits', () => {
11581160
})
11591161
})
11601162

1163+
describe('CodeHeader', () => {
1164+
it('should have no accessibility violations', async () => {
1165+
const component = await mountSuspended(CodeHeader, {
1166+
props: {
1167+
html: '<pre><code><span class="line">const x = 1;</span></code></pre>',
1168+
filePath: 'dir1/dir2/sourcefile.js',
1169+
loading: false,
1170+
isViewingFile: true,
1171+
isBinaryFile: false,
1172+
fileContent: '<pre><code><span class="line">const x = 1;</span></code></pre>',
1173+
markdownViewMode: 'preview',
1174+
selectedLines: null,
1175+
getCodeUrlWithPath: path => path,
1176+
packageName: 'vite',
1177+
version: '1.0.0',
1178+
},
1179+
})
1180+
const results = await runAxe(component)
1181+
expect(results.violations).toEqual([])
1182+
})
1183+
})
1184+
1185+
describe('CodeSkeletonLoader', () => {
1186+
it('should have no accessibility violations', async () => {
1187+
const component = await mountSuspended(CodeSkeletonLoader)
1188+
const results = await runAxe(component)
1189+
expect(results.violations).toEqual([])
1190+
})
1191+
})
1192+
11611193
describe('CodeViewer', () => {
11621194
it('should have no accessibility violations', async () => {
11631195
const component = await mountSuspended(CodeViewer, {

0 commit comments

Comments
 (0)