ember-a11y/ember-a11y-testing

a11yAudit fails to account for include/exclude context parameter

drewlee opened this issue · 2 comments

In addition to a query selector or HTML DOM node, the axe context argument can also include an "include/exclude" pojo. The a11yAudit helper fails to account for this argument format and assumes that the object is the options argument.

For example, the following invocation will execute on the entire document instead of the assigned scope, and will fail to apply the axe configurations set in environment.js:

await a11yAuditIf({
  include: [['.col-thread']],
  exclude: [
    ['[data-control-name="select_gif"]']
  ]
});

The current workaround is to assign null as the second argument to bypass the internal formatting check:

await a11yAuditIf({
  include: [['.col-thread']],
  exclude: [
    ['[data-control-name="select_gif"]']
  ]
}, null);

Source of the issue:

if (arguments.length === 1 && isPlainObj(contextSelector)) {
Needs a bit more thorough checking in addition to the pojo check.

Fix included in PR #132