open-nomad/ui/tests/helpers/a11y-audit.js
2022-01-20 09:46:45 -05:00

27 lines
721 B
JavaScript

import a11yAudit from 'ember-a11y-testing/test-support/audit';
function appendRuleOverrides(overriddenRules) {
const rules = {
'color-contrast': {
enabled: false,
},
'heading-order': {
enabled: false,
},
};
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');
}