From c555ff24d184947ab8e0df07b1e57f8b0d7dc2fd Mon Sep 17 00:00:00 2001 From: Rogan Creswick Date: Mon, 3 Jun 2013 14:37:58 -0700 Subject: minor bug fixes, started changing color rules to the new manifest format --- exampleData/ruleSets/backgroundCheck.js | 10 +++ exampleData/ruleSets/colorRules.json | 107 ++++++++++++++------------------ exampleData/ruleSets/foregroundCheck.js | 9 +++ 3 files changed, 64 insertions(+), 62 deletions(-) create mode 100644 exampleData/ruleSets/backgroundCheck.js create mode 100644 exampleData/ruleSets/foregroundCheck.js (limited to 'exampleData/ruleSets') diff --git a/exampleData/ruleSets/backgroundCheck.js b/exampleData/ruleSets/backgroundCheck.js new file mode 100644 index 0000000..7da59aa --- /dev/null +++ b/exampleData/ruleSets/backgroundCheck.js @@ -0,0 +1,10 @@ +function() { + var allow = '#00 #FF #3D #F7 #C2 #B4 #4E'.split(' '); + report("broken"); + $5(':visible') + .cssIsNot('background-color', allow, fiveui.color.colorToHex) + .each(function(i, elt) { + var color = fiveui.color.colorToHex($(elt).css('background-color')); + report('non-standard background color: ' + color, $(elt)); + }); +} diff --git a/exampleData/ruleSets/colorRules.json b/exampleData/ruleSets/colorRules.json index 8f10ee8..54fb549 100644 --- a/exampleData/ruleSets/colorRules.json +++ b/exampleData/ruleSets/colorRules.json @@ -4,89 +4,72 @@ * Test using exampleData/basic/testColorRules.html */ -{ 'name': 'Color Guidelines' -, 'description': 'Foreground/background color guidelines' -, 'rules': [ +{ "name": "Color Guidelines" +, "description": "Foreground/background color guidelines" +, "rules": [ //---------------------------------------------------------------- - { 'id': 2141101 - , 'name': 'Foreground check' - , 'description': 'Foreground colors should be in the set:'+ - '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738' - , 'rule': - function() { - 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')); - report('foreground color: ' + color, elt); - }); - } + { "name": "Foreground check" + , "description": ["Foreground colors should be in the set: \n", + "#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738"] + , "file": "foregroundCheck.js" }, //---------------------------------------------------------------- - { 'id': 2141102 - , 'name': 'Background check' - , 'description': 'Backgrounds colors should be in the set:' + - '#00 #FF #3D #F7 #C2 #B4 #4E' - , 'rule': - function() { - var allow = '#00 #FF #3D #F7 #C2 #B4 #4E'.split(' '); - $5(':visible') - .cssIsNot('background-color', allow, fiveui.color.colorToHex) - .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('background-color')); - report('non-standard background color: ' + color, $(elt)); - }); + { "name": "Background check" + , "description": ["Backgrounds colors should be in the set:", + "#00 #FF #3D #F7 #C2 #B4 #4E"] + , "file": "backgroundCheck.js" } - }, - //---------------------------------------------------------------- - { 'id': 2141103 - , 'name': 'Content area color' - , 'description': 'Background color should be: ' + - '#F7' - , 'rule': +] +} +//---------------------------------------------------------------- +/* { "id": 2141103 + , "name": "Content area color" + , "description": "Background color should be: " + + "#F7" + , "rule": function() { - var allow = '#F7'; - $5('#content') - .cssIsNot('background-color', allow, fiveui.color.colorToHex) + var allow = "#F7"; + $5("#content") + .cssIsNot("background-color", allow, fiveui.color.colorToHex) .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('background-color')); - report('non-standard content background color: ' + color, elt); + var color = fiveui.color.colorToHex($(elt).css("background-color")); + report("non-standard content background color: " + color, elt); }); } }, //---------------------------------------------------------------- - { 'id': 2141104 - , 'name': 'Left navigation color' - , 'description': 'Left navigation color should be: ' + - '#C2' - , 'rule': + { "id": 2141104 + , "name": "Left navigation color" + , "description": "Left navigation color should be: " + + "#C2" + , "rule": function() { - var allow = '#C2'; - $5('#leftNav') - .cssIsNot('color', allow, fiveui.color.colorToHex) + var allow = "#C2"; + $5("#leftNav") + .cssIsNot("color", allow, fiveui.color.colorToHex) .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('color')); - report('non-standard left navigation color: ' + color, elt); + var color = fiveui.color.colorToHex($(elt).css("color")); + report("non-standard left navigation color: " + color, elt); }); } }, //---------------------------------------------------------------- - { 'id': 2141105 - , 'name': 'Header color check' - , 'description': 'Header color should be: ' + - '#3D' - , 'rule': + { "id": 2141105 + , "name": "Header color check" + , "description": "Header color should be: " + + "#3D" + , "rule": function() { - var allow = '#3D'; - $5(':header') - .cssIsNot('color', allow, fiveui.color.colorToHex) + var allow = "#3D"; + $5(":header") + .cssIsNot("color", allow, fiveui.color.colorToHex) .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('color')); - report('non-standard header color: ' + color, elt); + var color = fiveui.color.colorToHex($(elt).css("color")); + report("non-standard header color: " + color, elt); }); } }//, //---------------------------------------------------------------- ] } + */ \ No newline at end of file diff --git a/exampleData/ruleSets/foregroundCheck.js b/exampleData/ruleSets/foregroundCheck.js new file mode 100644 index 0000000..32a8ee5 --- /dev/null +++ b/exampleData/ruleSets/foregroundCheck.js @@ -0,0 +1,9 @@ +function() { + 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')); + report('foreground color: ' + color, elt); + }); +} -- cgit v1.2.3