open-nomad/ui/tests/helpers/a11y-audit.js

27 lines
721 B
JavaScript
Raw Normal View History

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