-
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: add required-attr options, integration tests
- Loading branch information
Marcy Sutton
committed
Jan 6, 2018
1 parent
e30a372
commit 4f266c7
Showing
4 changed files
with
94 additions
and
0 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
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: ['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: ['aria-checked'] | ||
}] | ||
}); | ||
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-checked']); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |