Skip to content

Commit

Permalink
chore(is-accessible-ref): work with standards object (#2368)
Browse files Browse the repository at this point in the history
  • Loading branch information
straker authored Jul 14, 2020
1 parent a5ed47a commit 2908a7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/commons/aria/is-accessible-ref.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import lookupTable from './lookup-table';
import standards from '../../standards';
import getRootNode from '../dom/get-root-node';

const idRefsRegex = /^idrefs?$/;
Expand Down Expand Up @@ -52,8 +52,8 @@ function isAccessibleRef(node) {
if (!axe._cache.get('idRefs')) {
axe._cache.set('idRefs', {});
// Get all idref(s) attributes on the lookup table
const refAttrs = Object.keys(lookupTable.attributes).filter(attr => {
const { type } = lookupTable.attributes[attr];
const refAttrs = Object.keys(standards.ariaAttrs).filter(attr => {
const { type } = standards.ariaAttrs[attr];
return idRefsRegex.test(type);
});

Expand Down
15 changes: 9 additions & 6 deletions test/commons/aria/is-accessible-ref.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
describe('aria.isAccessibleRef', function() {
'use strict';

var __atrs;
var fixture = document.getElementById('fixture');
var isAccessibleRef = axe.commons.aria.isAccessibleRef;
var shadowSupport = axe.testUtils.shadowSupport.v1;

function setLookup(attrs) {
axe.commons.aria.lookupTable.attributes = attrs;
axe.configure({
standards: {
ariaAttrs: attrs
}
});
}

afterEach(function() {
fixture.innerHTML = '';
__atrs = axe.commons.aria.lookupTable.attributes;
before(function() {
axe._load({});
});

afterEach(function() {
axe.commons.aria.lookupTable.attributes = __atrs;
fixture.innerHTML = '';
axe.reset();
});

it('returns false by default', function() {
Expand Down

0 comments on commit 2908a7d

Please sign in to comment.