Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Description list not structured properly for screen readers #3053

67 changes: 17 additions & 50 deletions src/components/summary/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,20 +303,23 @@ const EXAMPLE_SUMMARY_MULTIPLE_GROUPS = {
],
};

// Disable specific axe rules to accommodate the testing scenario
const axeRules = {
rules: {
dlitem: {
enabled: false,
},
'definition-list': {
enabled: false,
},
},
};

describe('macro: summary', () => {
describe('mode: general', () => {
it('passes jest-axe checks', async () => {
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
const results = await axe($.html(), {
rules: {
dlitem: {
enabled: false,
},
'definition-list': {
enabled: false,
},
},
});
const results = await axe($.html(), axeRules);

expect(results).toHaveNoViolations();
});
Expand Down Expand Up @@ -529,16 +532,7 @@ describe('macro: summary', () => {
describe('mode: with title', () => {
it('passes jest-axe checks', async () => {
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_WITH_TITLE));
const results = await axe($.html(), {
rules: {
dlitem: {
enabled: false,
},
'definition-list': {
enabled: false,
},
},
});
const results = await axe($.html(), axeRules);

expect(results).toHaveNoViolations();
});
Expand All @@ -558,16 +552,7 @@ describe('macro: summary', () => {
variant: 'hub',
}),
);
const results = await axe($.html(), {
rules: {
dlitem: {
enabled: false,
},
'definition-list': {
enabled: false,
},
},
});
const results = await axe($.html(), axeRules);

expect(results).toHaveNoViolations();
});
Expand Down Expand Up @@ -601,16 +586,7 @@ describe('macro: summary', () => {
it('passes jest-axe checks', async () => {
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_WITH_NO_ROWS));

const results = await axe($.html(), {
rules: {
dlitem: {
enabled: false,
},
'definition-list': {
enabled: false,
},
},
});
const results = await axe($.html(), axeRules);
expect(results).toHaveNoViolations();
});

Expand Down Expand Up @@ -649,16 +625,7 @@ describe('macro: summary', () => {
describe('mode: card', () => {
it('passes jest-axe checks', async () => {
const $ = cheerio.load(renderComponent('summary', { ...EXAMPLE_SUMMARY_BASIC, variant: 'card' }));
const results = await axe($.html(), {
rules: {
dlitem: {
enabled: false,
},
'definition-list': {
enabled: false,
},
},
});
const results = await axe($.html(), axeRules);

expect(results).toHaveNoViolations();
});
Expand Down
Loading