diff --git a/lib/checks/aria/aria-unsupported-attr-evaluate.js b/lib/checks/aria/aria-unsupported-attr-evaluate.js
index 517d0057a6..50c233a054 100644
--- a/lib/checks/aria/aria-unsupported-attr-evaluate.js
+++ b/lib/checks/aria/aria-unsupported-attr-evaluate.js
@@ -1,14 +1,12 @@
-import { lookupTable, getRole, validateAttr } from '../../commons/aria';
+import { validateAttr } from '../../commons/aria';
+import standards from '../../standards';
import matches from '../../commons/matches';
import { getNodeAttributes } from '../../core/utils';
function ariaUnsupportedAttrEvaluate(node) {
- const nodeName = node.nodeName.toUpperCase();
- const role = getRole(node);
-
const unsupportedAttrs = Array.from(getNodeAttributes(node))
.filter(({ name }) => {
- const attribute = lookupTable.attributes[name];
+ const attribute = standards.ariaAttrs[name];
if (!validateAttr(name)) {
return false;
@@ -20,19 +18,7 @@ function ariaUnsupportedAttrEvaluate(node) {
return !!unsupported;
}
- // validate attributes and conditions (if any) from allowedElement to given node
- const isException = matches(node, unsupported.exceptions);
-
- if (!Object.keys(lookupTable.evaluateRoleForElement).includes(nodeName)) {
- return !isException;
- }
-
- // evaluate a given aria-role, execute the same
- return !lookupTable.evaluateRoleForElement[nodeName]({
- node,
- role,
- out: isException
- });
+ return !matches(node, unsupported.exceptions);
})
.map(candidate => candidate.name.toString());
diff --git a/lib/commons/aria/validate-attr.js b/lib/commons/aria/validate-attr.js
index 7977a24ed1..fc7a7f88aa 100644
--- a/lib/commons/aria/validate-attr.js
+++ b/lib/commons/aria/validate-attr.js
@@ -1,4 +1,4 @@
-import lookupTable from './lookup-table';
+import standards from '../../standards';
/**
* Check if an aria- attribute name is valid
@@ -9,7 +9,7 @@ import lookupTable from './lookup-table';
* @return {Boolean}
*/
function validateAttr(att) {
- const attrDefinition = lookupTable.attributes[att];
+ const attrDefinition = standards.ariaAttrs[att];
return !!attrDefinition;
}
diff --git a/test/checks/aria/unsupportedattr.js b/test/checks/aria/unsupportedattr.js
index efe7786c1d..9748ff936f 100644
--- a/test/checks/aria/unsupportedattr.js
+++ b/test/checks/aria/unsupportedattr.js
@@ -7,12 +7,20 @@ describe('unsupportedattr', function() {
afterEach(function() {
checkContext.reset();
+ axe.reset();
});
it('should return true if applied to an unsupported attribute', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: true
- };
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: true
+ }
+ }
+ }
+ });
+
var params = checkSetup(
'
Contents
'
);
@@ -20,12 +28,18 @@ describe('unsupportedattr', function() {
});
it('should return true with multiple unsupported and supported attributes', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: true
- };
- axe.commons.aria.lookupTable.attributes['aria-bagleypants'] = {
- unsupported: true
- };
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: true
+ },
+ 'aria-bagleypants': {
+ unsupported: true
+ }
+ }
+ }
+ });
var params = checkSetup(
'Contents
'
);
@@ -51,11 +65,17 @@ describe('unsupportedattr', function() {
});
it('should return false if applied to an element that matches the unsupported "exceptions" list', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: {
- exceptions: ['button']
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: {
+ exceptions: ['button']
+ }
+ }
+ }
}
- };
+ });
var params = checkSetup(
''
);
@@ -63,18 +83,24 @@ describe('unsupportedattr', function() {
});
it('should return false if applied to an element that matches the unsupported "exceptions" list using complex conditions', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: {
- exceptions: [
- {
- nodeName: 'input',
- properties: {
- type: 'checkbox'
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: {
+ exceptions: [
+ {
+ nodeName: 'input',
+ properties: {
+ type: 'checkbox'
+ }
+ }
+ ]
}
}
- ]
+ }
}
- };
+ });
var params = checkSetup(
''
);
@@ -82,11 +108,17 @@ describe('unsupportedattr', function() {
});
it('should return true if applied to an element that does not match the unsupported "exceptions" list', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: {
- exceptions: ['button']
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: {
+ exceptions: ['button']
+ }
+ }
+ }
}
- };
+ });
var params = checkSetup(
'Contents
'
);
@@ -94,18 +126,24 @@ describe('unsupportedattr', function() {
});
it('should return true if applied to an element that does not match the unsupported "exceptions" list using complex conditions', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: {
- exceptions: [
- {
- nodeName: 'input',
- properties: {
- type: 'checkbox'
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: {
+ exceptions: [
+ {
+ nodeName: 'input',
+ properties: {
+ type: 'checkbox'
+ }
+ }
+ ]
}
}
- ]
+ }
}
- };
+ });
var params = checkSetup(
''
);
diff --git a/test/checks/aria/valid-attr.js b/test/checks/aria/valid-attr.js
index fe9910fa1b..a4341a7b63 100644
--- a/test/checks/aria/valid-attr.js
+++ b/test/checks/aria/valid-attr.js
@@ -7,6 +7,7 @@ describe('aria-valid-attr', function() {
afterEach(function() {
fixture.innerHTML = '';
checkContext.reset();
+ axe.reset();
});
it('should return false if any invalid ARIA attributes are found', function() {
@@ -37,9 +38,15 @@ describe('aria-valid-attr', function() {
});
it('should return true for unsupported ARIA attributes', function() {
- axe.commons.aria.lookupTable.attributes['aria-mccheddarton'] = {
- unsupported: true
- };
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ 'aria-mccheddarton': {
+ unsupported: true
+ }
+ }
+ }
+ });
var node = document.createElement('div');
node.id = 'test';
diff --git a/test/commons/aria/attributes.js b/test/commons/aria/attributes.js
index 9dde9e7ddf..c8fd33ff4b 100644
--- a/test/commons/aria/attributes.js
+++ b/test/commons/aria/attributes.js
@@ -28,30 +28,3 @@ describe('aria.requiredAttr', function() {
assert.deepEqual(result, []);
});
});
-
-describe('aria.validateAttr', function() {
- 'use strict';
-
- var orig;
- beforeEach(function() {
- orig = axe.commons.aria.lookupTable.attributes;
- });
-
- afterEach(function() {
- axe.commons.aria.lookupTable.attributes = orig;
- });
-
- it('should return true if attribute is found in lut', function() {
- axe.commons.aria.lookupTable.attributes = {
- cats: {}
- };
-
- assert.isTrue(axe.commons.aria.validateAttr('cats'));
- });
-
- it('should return false if attribute is found in lut', function() {
- axe.commons.aria.lookupTable.attributes = {};
-
- assert.isFalse(axe.commons.aria.validateAttr('cats'));
- });
-});
diff --git a/test/commons/aria/validate-attr.js b/test/commons/aria/validate-attr.js
new file mode 100644
index 0000000000..aae83f06d4
--- /dev/null
+++ b/test/commons/aria/validate-attr.js
@@ -0,0 +1,23 @@
+describe('aria.validateAttr', function() {
+ 'use strict';
+
+ afterEach(function() {
+ axe.reset();
+ });
+
+ it('should return true if attribute is found in lut', function() {
+ axe.configure({
+ standards: {
+ ariaAttrs: {
+ cats: {}
+ }
+ }
+ });
+
+ assert.isTrue(axe.commons.aria.validateAttr('cats'));
+ });
+
+ it('should return false if attribute is found in lut', function() {
+ assert.isFalse(axe.commons.aria.validateAttr('cats'));
+ });
+});
diff --git a/test/integration/rules/aria-allowed-attr/failures.html b/test/integration/rules/aria-allowed-attr/failures.html
index 4b639c0eae..4a52f0b180 100644
--- a/test/integration/rules/aria-allowed-attr/failures.html
+++ b/test/integration/rules/aria-allowed-attr/failures.html
@@ -2,6 +2,3 @@
fail
fail
fail
-
-
-fail
diff --git a/test/integration/rules/aria-allowed-attr/failures.json b/test/integration/rules/aria-allowed-attr/failures.json
index 683a0a1e4c..07fc3dc9c5 100644
--- a/test/integration/rules/aria-allowed-attr/failures.json
+++ b/test/integration/rules/aria-allowed-attr/failures.json
@@ -1,5 +1,5 @@
{
"description": "aria-allowed-attr failing tests",
"rule": "aria-allowed-attr",
- "violations": [["#fail1"], ["#fail2"], ["#fail3"], ["#fail4"], ["#fail5"]]
+ "violations": [["#fail1"], ["#fail2"], ["#fail3"], ["#fail4"]]
}