Skip to content

Commit

Permalink
Build: add accessibility testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanb committed Aug 4, 2015
1 parent 6a9565e commit 5071b60
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 42 deletions.
17 changes: 9 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module.exports = function( grunt ) {
var path = require( "path" );
require( "load-grunt-config" )( grunt, {
configPath: [
path.join( process.cwd(), "tasks/options" ),
path.join( process.cwd(), "tasks" )
],
init: true
} );
grunt.loadNpmTasks("axe-grunt-webdriver");
var path = require( "path" );
require( "load-grunt-config" )( grunt, {
configPath: [
path.join( process.cwd(), "tasks/options" ),
path.join( process.cwd(), "tasks" )
],
init: true
} );
};
2 changes: 1 addition & 1 deletion demos/typography.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS Chassis - Typography</title>
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@
},
"dependencies": {},
"devDependencies": {
"axe-grunt-webdriver": "0.0.1",
"browser-perf": "1.2.3",
"chromedriver": "2.13.0",
"commitplease": "2.0.0",
"ejs-template": "0.1.0",
"grunt": "0.4.5",
"grunt-autoprefixer": "2.1.0",
"grunt-contrib-cssmin": "0.10.0",
"grunt-contrib-connect": "0.9.0",
"grunt-contrib-csslint": "0.4.0",
"grunt-contrib-cssmin": "0.10.0",
"grunt-contrib-jshint": "0.10.0",
"grunt-contrib-connect": "0.9.0",
"grunt-contrib-watch": "0.6.1",
"grunt-csscomb": "3.0.0",
"grunt-git-authors": "2.0.0",
Expand Down
5 changes: 3 additions & 2 deletions tasks/alias.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = function( grunt ) {
grunt.registerTask( "default", [ "test" ] );
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint" ] );
grunt.registerTask( "build", [ "svg", "sass", "csscomb", "cssmin" ] );
grunt.registerTask( "accessibility", [ "connect:accessibility", "axe-webdriver"])
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint", "accessibility" ] );
grunt.registerTask( "build", [ "variables", "svg", "sass", "csscomb", "cssmin" ] );
grunt.registerTask( "perf", [
"start-selenium-server",
"connect:perf",
Expand Down
9 changes: 9 additions & 0 deletions tasks/options/axe-webdriver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
firefox: {
options: {
threshold: 0
},
urls: ['http://localhost:4200/demos/typography.html'],
dest: 'tmp/gu.json'
}
};
50 changes: 27 additions & 23 deletions tasks/options/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@ var template = require( "ejs-template" ),
module.exports = {
options: {
port: 4200,
base: ".",
middleware: [
template.middleware({ basedir: __dirname }),
function( req, res ) {
var data, i,
url = urlParser.parse( req.url, true ),
query = {},
parts = url.pathname.split( "/" ),
file = req.url.replace( /^\//, "" ).split( "?" )[ 0 ];
base: "."
},
perf: {
options: {
middleware: [
template.middleware({ basedir: __dirname }),
function( req, res ) {
var data, i,
url = urlParser.parse( req.url, true ),
query = {},
parts = url.pathname.split( "/" ),
file = req.url.replace( /^\//, "" ).split( "?" )[ 0 ];

for ( i = 1; i < parts.length; i += 2 ) {
query[ parts[ i ] ] = parts[ i + 1 ];
for ( i = 1; i < parts.length; i += 2 ) {
query[ parts[ i ] ] = parts[ i + 1 ];
}
if ( file.split( "." ).length <= 1 ) {
data = componentGenerator.generate(
query.framework,
query.component,
query.count
);
file = "../../performance/component.html";
}
res.endTemplate( file, data );
}
if ( file.split( "." ).length <= 1 ) {
data = componentGenerator.generate(
query.framework,
query.component,
query.count
);
file = "../../performance/component.html";
}
res.endTemplate( file, data );
}
]
]
}
},
perf: {},
accessibility: {},
dev: {
options: {
keepalive: true
Expand Down
8 changes: 6 additions & 2 deletions tasks/options/perfjankie.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = {
module.exports = function( grunt ) {
grunt.loadNpmTasks( "perfjankie" );

return {
options: {
suite: "perfSlides - Performance Analysis"
},
Expand Down Expand Up @@ -40,4 +43,5 @@ module.exports = {
]
}
}
}
};
};
9 changes: 5 additions & 4 deletions tasks/variables.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module.exports = function( grunt ) {
grunt.registerTask( "buildVariables", function() {
grunt.registerTask( "variables", function() {
var jsass = require( "jsass-vars" );
var path = require( "path" );
var varPath = path.join( process.cwd(), "scss/variables/*" );

var distPath = path.join( process.cwd(), "dist" );
grunt.file.mkdir( distPath );
jsass( varPath, {
"dest": path.join( process.cwd(), "dist" ),
"dest": distPath,
"name": "chassis"
} );
} )
};
};

0 comments on commit 5071b60

Please sign in to comment.