aboutsummaryrefslogtreecommitdiff
path: root/exampleData
diff options
context:
space:
mode:
authorGravatar Trevor Elliott <trevor@galois.com>2013-06-13 16:25:06 -0700
committerGravatar Trevor Elliott <trevor@galois.com>2013-06-13 16:25:06 -0700
commitdcef9bbbdf681791a21cdb55a2a7960d22fc53c9 (patch)
treee91d3fa2381ee85701744f23e78b1ccefd39b961 /exampleData
parent0aa7436f015bf6e071a2bf2d3edd393ad0064dec (diff)
Switch to passing a report object to rules, instead of binding this
Diffstat (limited to 'exampleData')
-rw-r--r--exampleData/ruleSets/colorRules/backgroundCheck.js13
-rw-r--r--exampleData/ruleSets/colorRules/foregroundCheck.js15
2 files changed, 11 insertions, 17 deletions
diff --git a/exampleData/ruleSets/colorRules/backgroundCheck.js b/exampleData/ruleSets/colorRules/backgroundCheck.js
index d860410..eb070db 100644
--- a/exampleData/ruleSets/colorRules/backgroundCheck.js
+++ b/exampleData/ruleSets/colorRules/backgroundCheck.js
@@ -6,17 +6,12 @@ exports.description =
, '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'
].join('\n');
-exports.rule = function() {
- var rule = this;
-
-
+exports.rule = function(report) {
var allow = '#00 #FF #3D #F7 #C2 #B4 #4E'.split(' ');
- rule.report("broken");
$5(':visible')
.cssIsNot('background-color', allow, fiveui.color.colorToHex)
.each(function(i, elt) {
- var color = fiveui.color.colorToHex($(elt).css('background-color'));
- eonsole.log(rule);
- rule.report('non-standard background color: ' + color, $(elt));
- });
+ var color = fiveui.color.colorToHex($(elt).css('background-color'));
+ report.error('non-standard background color: ' + color, $(elt));
+ });
};
diff --git a/exampleData/ruleSets/colorRules/foregroundCheck.js b/exampleData/ruleSets/colorRules/foregroundCheck.js
index 9102bbe..0cbb2ae 100644
--- a/exampleData/ruleSets/colorRules/foregroundCheck.js
+++ b/exampleData/ruleSets/colorRules/foregroundCheck.js
@@ -1,17 +1,16 @@
-exports.name = 'Background Check';
+exports.name = 'Foreground Check';
exports.description =
- [ 'Backgrounds colors should be in the set:'
- , '#00 #FF #3D #F7 #C2 #B4 #4E'
+ [ 'Foreground colors should be in the set:'
+ , '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'
].join('\n');
-exports.rule = function() {
- var rule = this;
+exports.rule = function(report) {
var allow = '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'.split(' ');
$5(':visible')
.cssIsNot('color', allow, fiveui.color.colorToHex)
.each(function(i, elt) {
- var color = fiveui.color.colorToHex($(elt).css('color'));
- rule.report('foreground color: ' + color, elt);
- });
+ var color = fiveui.color.colorToHex($(elt).css('color'));
+ report.error('foreground color: ' + color, elt);
+ });
};