aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets
diff options
context:
space:
mode:
authorGravatar Rogan Creswick <creswick@gmail.com>2012-05-14 11:13:01 -0700
committerGravatar Rogan Creswick <creswick@gmail.com>2012-05-14 11:13:01 -0700
commit3626fd6c06c45a413ec1f0f9141734613eeab1ef (patch)
tree3f8a107fd66b121c1dd5c3e1e34c179b851e9d19 /exampleData/ruleSets
parent2946c44b616baf39cb41943a9b1fa5328dc6f7d2 (diff)
updated batch runner to do initial rule set testing
Diffstat (limited to 'exampleData/ruleSets')
-rw-r--r--exampleData/ruleSets/emptyHeadings.json15
-rw-r--r--exampleData/ruleSets/headingGuidelines.json35
2 files changed, 50 insertions, 0 deletions
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