Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test: default rule
- Loading branch information
Showing
14 changed files
with
134 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ | |
"process", | ||
"describe", | ||
"it", | ||
"console" | ||
"console", | ||
"JSHINT", | ||
"CSSLint" | ||
] | ||
} |
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
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,34 @@ | ||
#!/usr/bin/env node | ||
|
||
var program = require('commander'); | ||
|
||
function map(val) { | ||
var objMap = {}; | ||
val.split(',').forEach(function(item){ | ||
var arrItem = item.split(/\s*=\s*/); | ||
objMap[arrItem[0]] = arrItem[1]?arrItem[1]:true; | ||
}); | ||
return objMap; | ||
} | ||
|
||
program.on('--help', function(){ | ||
console.log(' Examples:'); | ||
console.log(''); | ||
console.log(' htmlhint -l'); | ||
console.log(' htmlhint -r tag-pair,id-class-value=underline test.html'); | ||
console.log(' htmlhint -c .htmlhintrc test.html'); | ||
console.log(''); | ||
}); | ||
|
||
program | ||
.version('0.9.2') | ||
.usage('[options] <file ...>') | ||
.option('-l, --list', 'show all of the rules available.') | ||
.option('-c, --config <file>', 'custom configuration file.') | ||
.option('-r, --rules <ruleid, ruleid=value ...>', 'set all of the rules available.', map) | ||
.parse(process.argv); | ||
|
||
console.log(' list: %j', program.list); | ||
console.log(' config: %j', program.config); | ||
console.log(' rules: %j', program.rules); | ||
console.log(' args: %j', program.args); |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Copyright (c) 2013, Yanis Wang <yanis.wang@gmail.com> | ||
* MIT Licensed | ||
*/ | ||
|
||
var expect = require("expect.js"); | ||
|
||
var HTMLHint = require("../../index").HTMLHint; | ||
|
||
describe('Rules: default', function(){ | ||
|
||
it('should result 3 errors', function(){ | ||
var code = '<p TEST="abc">'; | ||
var messages = HTMLHint.verify(code); | ||
expect(messages.length).to.be(3); | ||
}); | ||
|
||
}); |
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