diff options
author | Rogan Creswick <creswick@gmail.com> | 2012-05-14 11:13:01 -0700 |
---|---|---|
committer | Rogan Creswick <creswick@gmail.com> | 2012-05-14 11:13:01 -0700 |
commit | 3626fd6c06c45a413ec1f0f9141734613eeab1ef (patch) | |
tree | 3f8a107fd66b121c1dd5c3e1e34c179b851e9d19 /exampleData | |
parent | 2946c44b616baf39cb41943a9b1fa5328dc6f7d2 (diff) |
updated batch runner to do initial rule set testing
Diffstat (limited to 'exampleData')
-rw-r--r-- | exampleData/basic/testheadings.html | 24 | ||||
-rw-r--r-- | exampleData/ruleSets/emptyHeadings.json | 15 | ||||
-rw-r--r-- | exampleData/ruleSets/headingGuidelines.json | 35 |
3 files changed, 74 insertions, 0 deletions
diff --git a/exampleData/basic/testheadings.html b/exampleData/basic/testheadings.html new file mode 100644 index 0000000..456ba82 --- /dev/null +++ b/exampleData/basic/testheadings.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> + <head> + <script src="../../contexts/data/fiveui/selenium/selenium-injected-compute.js"></script> + <script src="../../contexts/data/lib/jquery/jquery-1.7.1.min.js"></script> + <script src="../../contexts/data/fiveui/injected/prelude.js"></script> + + <script src="../../contexts/data/fiveui/injected/fiveui-injected-compute.js"></script> + </head> +<body> +<h1>this heading is not in sentence case</h1> +<p> +Sample text +</p> +<h2>neither is this heading</h2> +<h1>This heading is in sentence case</h1> +<p> +Here's an empty heading: +</p> +<h1></h1> +<h1>This Heading is in Title Case</h1> +</div> +</body> +</html> 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 |