Comparing version 0.7.0-beta to 0.7.0-beta2
@@ -62,3 +62,11 @@ 'use strict'; | ||
Lesshint.prototype.checkString = function (input, checkPath) { | ||
return linter.lint(input, checkPath, this.config); | ||
var result; | ||
try { | ||
result = linter.lint(input, checkPath, this.config); | ||
} catch (e) { | ||
result = []; | ||
} | ||
return result; | ||
}; | ||
@@ -65,0 +73,0 @@ |
@@ -29,3 +29,3 @@ 'use strict'; | ||
case 'lowercase': | ||
if (!/^#[0-9a-f]+$/.test(color)) { | ||
if (!/^#[0-9a-z]+$/.test(color)) { | ||
message = color + ' should be written in lowercase.'; | ||
@@ -36,3 +36,3 @@ } | ||
case 'uppercase': | ||
if (!/^#[0-9A-F]+$/.test(color)) { | ||
if (!/^#[0-9A-Z]+$/.test(color)) { | ||
message = color + ' should be written in uppercase.'; | ||
@@ -39,0 +39,0 @@ } |
{ | ||
"name": "lesshint", | ||
"description": "A tool to aid you in writing clean and consistent Less.", | ||
"version": "0.7.0-beta", | ||
"version": "0.7.0-beta2", | ||
"main": "./lib/lesshint.js", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -124,2 +124,15 @@ var assert = require('assert'); | ||
}); | ||
it('should return an empty array on invalid input', function () { | ||
var string = '.foo{'; | ||
var lesshint = new Lesshint(); | ||
var errors; | ||
lesshint.configure(); | ||
errors = lesshint.checkString(string); | ||
assert.ok(errors.length === 0); | ||
}); | ||
}); | ||
@@ -126,0 +139,0 @@ |
@@ -227,3 +227,3 @@ var assert = require('assert'); | ||
it('should ignore invalid colors', function () { | ||
it('should ignore colors with invalid length', function () { | ||
var source = 'color: #abc1;'; | ||
@@ -248,2 +248,22 @@ var ast; | ||
it('should ignore colors with invalid characters', function () { | ||
var source = 'color: #abck;'; | ||
var ast; | ||
var options = { | ||
hexNotation: { | ||
enabled: true, | ||
style: 'lowercase' | ||
} | ||
}; | ||
ast = linter.parseAST(source); | ||
ast = ast.first('declaration').first('value').first('color'); | ||
assert.strictEqual(true, hexNotation({ | ||
config: options, | ||
node: ast | ||
})); | ||
}); | ||
it('should return null when disabled', function () { | ||
@@ -250,0 +270,0 @@ var source = 'color: #abc;'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
215640
5609