Skip to content

Instantly share code, notes, and snippets.

@marcysutton
Created August 31, 2016 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcysutton/c221a5b855bccbfd32bc7442738e3d49 to your computer and use it in GitHub Desktop.
Save marcysutton/c221a5b855bccbfd32bc7442738e3d49 to your computer and use it in GitHub Desktop.
JSDOM test
var jsdom = require('jsdom');
// Some html page
var html = [
'<html>',
'<body>',
'<p>An image without an alt tag! <img src="some.jpg" /></p>',
'<h2>Not an h1</h2>',
'<h5>blabla</h5>',
'<h4></h4>',
'</body>',
'</html>'
].join('\n');
jsdom.env(html, function(err, window) {
global.window = window;
global.Node = window.Node;
global.NodeList = window.NodeList;
var axe = require('./axe.js');
// var config = {
// rules: {
// 'color-contrast': {enabled: false}
// }
// }
var config = {};
// Run the checks
axe.a11yCheck(window.document, config, function(data) {
console.log(data);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment