2020-07-28 17:59:14 +00:00
|
|
|
import a11yAudit from 'ember-a11y-testing/test-support/audit';
|
|
|
|
|
2020-08-25 15:56:02 +00:00
|
|
|
function appendRuleOverrides(overriddenRules) {
|
2020-07-28 17:59:14 +00:00
|
|
|
const rules = {
|
|
|
|
'color-contrast': {
|
2020-08-25 15:56:02 +00:00
|
|
|
enabled: false,
|
2020-07-28 17:59:14 +00:00
|
|
|
},
|
|
|
|
'heading-order': {
|
2020-08-25 15:56:02 +00:00
|
|
|
enabled: false,
|
|
|
|
},
|
2020-07-28 17:59:14 +00:00
|
|
|
};
|
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
overriddenRules.forEach((rule) => (rules[rule] = { enabled: false }));
|
2020-08-25 15:56:02 +00:00
|
|
|
|
|
|
|
return rules;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default async function defaultA11yAudit(assert, ...overriddenRules) {
|
|
|
|
await a11yAudit({ rules: appendRuleOverrides(overriddenRules) });
|
|
|
|
assert.ok(true, 'a11y audit passes');
|
|
|
|
}
|
2020-07-28 17:59:14 +00:00
|
|
|
|
2020-08-25 15:56:02 +00:00
|
|
|
export async function componentA11yAudit(element, assert, ...overriddenRules) {
|
|
|
|
await a11yAudit(element, { rules: appendRuleOverrides(overriddenRules) });
|
|
|
|
assert.ok(true, 'a11y audit passes');
|
2020-07-28 17:59:14 +00:00
|
|
|
}
|