Skip to content

Commit 219fe62

Browse files
committed
test: add a11y test
1 parent e7e612d commit 219fe62

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

test/nuxt/a11y.spec.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ import HeaderAccountMenuServer from '~/components/Header/AccountMenu.server.vue'
204204
import ToggleServer from '~/components/Settings/Toggle.server.vue'
205205
import SearchProviderToggleServer from '~/components/SearchProviderToggle.server.vue'
206206
import PackageTrendsChart from '~/components/Package/TrendsChart.vue'
207+
import SizeIncrease from '~/components/Package/SizeIncrease.vue'
207208

208209
describe('component accessibility audits', () => {
209210
describe('DateTime', () => {
@@ -2615,6 +2616,71 @@ describe('component accessibility audits', () => {
26152616
expect(results.violations).toEqual([])
26162617
})
26172618
})
2619+
2620+
describe('SizeIncrease', () => {
2621+
it('should have no accessibility violations', async () => {
2622+
const component = await mountSuspended(SizeIncrease, {
2623+
props: {
2624+
diff: {
2625+
comparisonVersion: '1.0.0',
2626+
sizeRatio: 1,
2627+
sizeIncrease: 200,
2628+
currentSize: 400,
2629+
previousSize: 200,
2630+
depDiff: 5,
2631+
currentDeps: 10,
2632+
previousDeps: 5,
2633+
sizeThresholdExceeded: true,
2634+
depThresholdExceeded: true,
2635+
},
2636+
},
2637+
})
2638+
const results = await runAxe(component)
2639+
expect(results.violations).toEqual([])
2640+
})
2641+
2642+
it('should have no accessibility violations with only size increase', async () => {
2643+
const component = await mountSuspended(SizeIncrease, {
2644+
props: {
2645+
diff: {
2646+
comparisonVersion: '1.0.0',
2647+
sizeRatio: 1,
2648+
sizeIncrease: 200,
2649+
currentSize: 400,
2650+
previousSize: 200,
2651+
depDiff: 0,
2652+
currentDeps: 5,
2653+
previousDeps: 5,
2654+
sizeThresholdExceeded: true,
2655+
depThresholdExceeded: false,
2656+
},
2657+
},
2658+
})
2659+
const results = await runAxe(component)
2660+
expect(results.violations).toEqual([])
2661+
})
2662+
2663+
it('should have no accessibility violations with only dependency increase', async () => {
2664+
const component = await mountSuspended(SizeIncrease, {
2665+
props: {
2666+
diff: {
2667+
comparisonVersion: '1.0.0',
2668+
sizeRatio: 0,
2669+
sizeIncrease: 0,
2670+
currentSize: 200,
2671+
previousSize: 200,
2672+
depDiff: 5,
2673+
currentDeps: 10,
2674+
previousDeps: 5,
2675+
sizeThresholdExceeded: false,
2676+
depThresholdExceeded: true,
2677+
},
2678+
},
2679+
})
2680+
const results = await runAxe(component)
2681+
expect(results.violations).toEqual([])
2682+
})
2683+
})
26182684
})
26192685

26202686
function applyTheme(colorMode: string, bgTheme: string | null) {

0 commit comments

Comments
 (0)