Skip to content

Instantly share code, notes, and snippets.

@marcysutton
Created August 31, 2016 21:47
Show Gist options
  • Select an option

  • Save marcysutton/c221a5b855bccbfd32bc7442738e3d49 to your computer and use it in GitHub Desktop.

Select an option

Save marcysutton/c221a5b855bccbfd32bc7442738e3d49 to your computer and use it in GitHub Desktop.

Revisions

  1. marcysutton renamed this gist Aug 31, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. marcysutton created this gist Aug 31, 2016.
    34 changes: 34 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    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);
    });
    });