From 3626fd6c06c45a413ec1f0f9141734613eeab1ef Mon Sep 17 00:00:00 2001 From: Rogan Creswick Date: Mon, 14 May 2012 11:13:01 -0700 Subject: updated batch runner to do initial rule set testing --- exampleData/ruleSets/emptyHeadings.json | 15 +++++++++++++ exampleData/ruleSets/headingGuidelines.json | 35 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 exampleData/ruleSets/emptyHeadings.json create mode 100644 exampleData/ruleSets/headingGuidelines.json (limited to 'exampleData/ruleSets') diff --git a/exampleData/ruleSets/emptyHeadings.json b/exampleData/ruleSets/emptyHeadings.json new file mode 100644 index 0000000..5dbdc1f --- /dev/null +++ b/exampleData/ruleSets/emptyHeadings.json @@ -0,0 +1,15 @@ +{ "name": "Header Rule Set" +, "description": "Simple rules about HTML headers." +, "rules": + [ { "name": "Disallow Empty Headers" + , "description": "Heading elements should contain text." + , "rule": function() { + fiveui.query(':header').each(function(ix, elt) { + if($(elt).text() == '') { + report('Heading does not contain text', elt); + } + }); + } + } + ] +} diff --git a/exampleData/ruleSets/headingGuidelines.json b/exampleData/ruleSets/headingGuidelines.json new file mode 100644 index 0000000..43ee1a4 --- /dev/null +++ b/exampleData/ruleSets/headingGuidelines.json @@ -0,0 +1,35 @@ +{ "name": "Heading Guidelines" +, "description": "Guidelines pertaining to the formatting and content of headings." +, "rules": [ { "name": "Headings are capitalized" + , "description": "Check to see if all headings use leading capital letters." + , "rule": + function() { + var badHeadings = + fiveui.query(':header').filter( + function(idx) { + var ch = $(this).text()[0]; + if (ch) { + return (ch == ch.toLowerCase() ); + } else { + return false; + } + }); + $(badHeadings).map(function(idx, elt){ + report('Heading does not start with a capitol letter.', elt); + }); + + } + }, + { "name": "Disallow Empty Headers" + , "description": "Heading elements should contain text." + , "rule": function() { + fiveui.query(':header').each( + function(ix, elt) { + if($(elt).text() == '') { + report('Heading does not contain text', elt); + } + }); + } + } + ] +} \ No newline at end of file -- cgit v1.2.3