Skip to content

Commit 5280447

Browse files
committed
test: add a11y test cases
1 parent cdf7245 commit 5280447

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

test/nuxt/a11y.spec.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ import FacetBarChart from '~/components/Compare/FacetBarChart.vue'
270270
import FacetScatterChart from '~/components/Compare/FacetScatterChart.vue'
271271
import PackageLikeCard from '~/components/Package/LikeCard.vue'
272272
import SizeIncrease from '~/components/Package/SizeIncrease.vue'
273+
import SizeDecrease from '~/components/Package/SizeDecrease.vue'
273274
import Likes from '~/components/Package/Likes.vue'
274275
import type { VueUiXyDatasetItem } from 'vue-data-ui'
275276

@@ -3966,6 +3967,7 @@ describe('component accessibility audits', () => {
39663967
const component = await mountSuspended(SizeIncrease, {
39673968
props: {
39683969
diff: {
3970+
direction: 'increase',
39693971
comparisonVersion: '1.0.0',
39703972
sizeRatio: 1,
39713973
sizeIncrease: 200,
@@ -3987,6 +3989,7 @@ describe('component accessibility audits', () => {
39873989
const component = await mountSuspended(SizeIncrease, {
39883990
props: {
39893991
diff: {
3992+
direction: 'increase',
39903993
comparisonVersion: '1.0.0',
39913994
sizeRatio: 1,
39923995
sizeIncrease: 200,
@@ -4008,6 +4011,7 @@ describe('component accessibility audits', () => {
40084011
const component = await mountSuspended(SizeIncrease, {
40094012
props: {
40104013
diff: {
4014+
direction: 'increase',
40114015
comparisonVersion: '1.0.0',
40124016
sizeRatio: 0,
40134017
sizeIncrease: 0,
@@ -4026,6 +4030,74 @@ describe('component accessibility audits', () => {
40264030
})
40274031
})
40284032

4033+
describe('SizeDecrease', () => {
4034+
it('should have no accessibility violations', async () => {
4035+
const component = await mountSuspended(SizeDecrease, {
4036+
props: {
4037+
diff: {
4038+
direction: 'decrease',
4039+
comparisonVersion: '1.0.0',
4040+
sizeRatio: -0.5,
4041+
sizeIncrease: -200,
4042+
currentSize: 200,
4043+
previousSize: 400,
4044+
depDiff: -5,
4045+
currentDeps: 5,
4046+
previousDeps: 10,
4047+
sizeThresholdExceeded: true,
4048+
depThresholdExceeded: true,
4049+
},
4050+
},
4051+
})
4052+
const results = await runAxe(component)
4053+
expect(results.violations).toEqual([])
4054+
})
4055+
4056+
it('should have no accessibility violations with only size decrease', async () => {
4057+
const component = await mountSuspended(SizeDecrease, {
4058+
props: {
4059+
diff: {
4060+
direction: 'decrease',
4061+
comparisonVersion: '1.0.0',
4062+
sizeRatio: -0.5,
4063+
sizeIncrease: -200,
4064+
currentSize: 200,
4065+
previousSize: 400,
4066+
depDiff: 0,
4067+
currentDeps: 5,
4068+
previousDeps: 5,
4069+
sizeThresholdExceeded: true,
4070+
depThresholdExceeded: false,
4071+
},
4072+
},
4073+
})
4074+
const results = await runAxe(component)
4075+
expect(results.violations).toEqual([])
4076+
})
4077+
4078+
it('should have no accessibility violations with only dependency decrease', async () => {
4079+
const component = await mountSuspended(SizeDecrease, {
4080+
props: {
4081+
diff: {
4082+
direction: 'decrease',
4083+
comparisonVersion: '1.0.0',
4084+
sizeRatio: 0,
4085+
sizeIncrease: 0,
4086+
currentSize: 200,
4087+
previousSize: 200,
4088+
depDiff: -5,
4089+
currentDeps: 5,
4090+
previousDeps: 10,
4091+
sizeThresholdExceeded: false,
4092+
depThresholdExceeded: true,
4093+
},
4094+
},
4095+
})
4096+
const results = await runAxe(component)
4097+
expect(results.violations).toEqual([])
4098+
})
4099+
})
4100+
40294101
describe('PackageActionBar', () => {
40304102
it('should have no accessibility violations', async () => {
40314103
const component = await mountSuspended(PackageActionBar)

0 commit comments

Comments
 (0)