-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow options in aria-allowed-attr, aria-required-attr (#673)
* chore: rename lut in tests * feat: allow options in aria-allowed-attr * chore: rename options integ. tests for clarity * feat: add required-attr options, integration tests * chore: PR feedback for aria-allowed-attr * feat: use object for ARIA check options e.g. {separator: ['aria-valuenow', 'aria-valuemin', aria-valuemax']} * chore: remove duplicate to-array util The exact same code existed in axe.utils and axe.commons (as axe.utils.toArray) * chore: simplify ARIA options usage
- Loading branch information
1 parent
659a85b
commit ffae2c0
Showing
14 changed files
with
190 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/integration/full/configure-options/configure-options.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
50 changes: 50 additions & 0 deletions
50
test/integration/full/configure-options/configure-options.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
|
||
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(); | ||
}); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/integration/full/options/options.js → ...ll/options-parameter/options-parameter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters