aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/textRules.json
diff options
context:
space:
mode:
Diffstat (limited to 'exampleData/ruleSets/textRules.json')
-rw-r--r--exampleData/ruleSets/textRules.json57
1 files changed, 57 insertions, 0 deletions
diff --git a/exampleData/ruleSets/textRules.json b/exampleData/ruleSets/textRules.json
new file mode 100644
index 0000000..337bbc4
--- /dev/null
+++ b/exampleData/ruleSets/textRules.json
@@ -0,0 +1,57 @@
+{ "name": "Text capitalization guidelines"
+, "description": "Guidelines regarding capitalization of text withing the page"
+, "rules": [
+ //---------------------------------------------------------------
+ { "id": 13
+ , "name": "Sentence case"
+ , "description": "Titles should be written in sentence case"
+ , "rule":
+ function() {
+ var posLength = function(ar) {
+ return 1 <= ar.length;
+ };
+
+ /**
+ * Test str to see if it is in sentence case.
+ */
+ var assertSentenceCase = function(inStr, elt) {
+ var str = fiveui.string.trim(inStr);
+
+ if ( !fiveui.word.capitalized(str[0]) ) {
+ report('The heading: "'+str+'" is not in sentence case.', elt);
+ return;
+ }
+
+ var tokens = str.split(' ').filter(posLength);
+
+ for (var i=1; i < tokens.length; ++i) {
+ if (fiveui.word.capitalized(tokens[i])) {
+ report('The heading: "'+str+'" is not in sentence case.', elt);
+ return;
+ }
+ }
+ };
+
+ fiveui.query(':header').each(function(idx, elt) {
+ assertSentenceCase($(elt).text(), elt);
+ });
+ }
+ },
+ //---------------------------------------------------------------
+ { "id":14
+ , "name": "Capitalization check"
+ , "description": "Capitalize \"Galois\" and \"Galwegian\" when referring to the company"
+ , "rule":
+ function() {
+ fiveui.query('*').hasText('galois').each(function (i, elt) {
+ report('"Galois" should be capitalized', elt);
+ })
+
+ fiveui.query('*').hasText('galwegian').each(function (i, elt) {
+ report('"Galwegian" should be capitalized', elt);
+ })
+ }
+ }//,
+ //---------------------------------------------------------------
+ ]
+}