-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support options in aria-allowed-attr and aria-required-attr #673
Changes from all commits
66646a8
cf9af49
e30a372
4f266c7
69fba9d
fd6d671
86fd5bf
a51514d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!doctype html> | ||
<html lang="en" id="main"> | ||
<head> | ||
<title></title> | ||
<meta charset="utf8"> | ||
<link rel="stylesheet" type="text/css" href="/node_modules/mocha/mocha.css" /> | ||
<script src="/node_modules/mocha/mocha.js"></script> | ||
<script src="/node_modules/chai/chai.js"></script> | ||
<script src="/axe.js"></script> | ||
<script> | ||
mocha.setup({ | ||
timeout: 50000, | ||
ui: 'bdd' | ||
}); | ||
var assert = chai.assert; | ||
</script> | ||
</head> | ||
<body> | ||
<div id="target"></div> | ||
|
||
<div id="mocha"></div> | ||
<script src="configure-options.js"></script> | ||
<script src="/test/integration/adapter.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
describe('Check Configure Options', function() { | ||
'use strict'; | ||
|
||
var target = document.querySelector('#target'); | ||
|
||
describe('aria-allowed-attr', function() { | ||
it('should allow an attribute supplied in options', function(done) { | ||
target.setAttribute('role', 'separator'); | ||
target.setAttribute('aria-valuenow', '0'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the event that 'aria-valuenow' becomes an allowed attribute in our lookup table, this test won't be testing anything anymore. Just to make the test more future-proof, I suggest using a random value like 'peanutbutter' instead of a real attribute so we can guarantee the test will always be testing the override functionality with a truly unexpected value. |
||
|
||
axe.configure({ | ||
checks: [{ | ||
id: 'aria-allowed-attr', | ||
options: {'separator': ['aria-valuenow']} | ||
}] | ||
}); | ||
axe.run(target, { | ||
runOnly: { | ||
type: 'rule', | ||
values: [ 'aria-allowed-attr' ] | ||
} | ||
}, function(error, results) { | ||
assert.lengthOf(results.violations, 0, 'violations'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('aria-required-attr', function() { | ||
it('should report unique attributes when supplied from options', function(done) { | ||
target.setAttribute('role', 'slider'); | ||
axe.configure({ | ||
checks: [{ | ||
id: 'aria-required-attr', | ||
options: {slider: ['aria-snuggles']} | ||
}] | ||
}); | ||
axe.run('#target', { | ||
runOnly: { | ||
type: 'rule', | ||
values: [ 'aria-required-attr' ] | ||
} | ||
}, function(error, results) { | ||
assert.lengthOf(results.violations, 1, 'violations'); | ||
assert.sameMembers(results.violations[0].nodes[0].any[0].data, ['aria-valuemax', 'aria-valuemin', 'aria-snuggles']); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super minor, but it'd be nice if this iterated over an arbitrary number of array inputs.