Skip to content

Commit

Permalink
feat: Update PhantomJS example
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Feb 26, 2018
1 parent cf70f9f commit 641b5e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
10 changes: 8 additions & 2 deletions doc/examples/phantomjs/axe-phantom.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if (args.length < 2) {
phantom.exit(1);
}

console.log('Testing, please wait...')

page.open(args[1], function (status) {
// Check for page load success
if (status !== 'success') {
Expand Down Expand Up @@ -37,9 +39,13 @@ page.open(args[1], function (status) {
if (args[2]) {
fs.write(args[2], JSON.stringify(msg, null, ' '), 'w');
} else {
console.log(JSON.stringify(msg, null, ' '));
if (msg.violations.length) {
console.log(JSON.stringify(msg.violations, null, ' '));
} else {
console.log('No violations found!')
}
}

phantom.exit();
phantom.exit(msg.violations.length);
};
});
19 changes: 19 additions & 0 deletions doc/examples/phantomjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "axe-phantomjs-example",
"description": "aXe Mocha Example",
"version": "0.0.1",
"private": true,
"author": {
"name": "Wlico Fiers",
"organization": "Deque Systems, Inc.",
"url": "http://deque.com/"
},
"dependencies": {},
"scripts": {
"test": "phantomjs axe-phantom.js http://www.deque.com"
},
"devDependencies": {
"axe-core": "^2.6.1",
"phantomjs": "^2.1.7"
}
}

0 comments on commit 641b5e6

Please sign in to comment.