aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets
diff options
context:
space:
mode:
authorGravatar Benjamin Jones <bjones@galois.com>2013-02-06 15:23:56 -0800
committerGravatar Benjamin Jones <bjones@galois.com>2013-02-06 15:23:56 -0800
commit2b8efa0da5e16f5850abf642202b44f56cc609d0 (patch)
treed7aa3216ecee566cc2f3235230d0985061ba39b4 /exampleData/ruleSets
parentca69f84825da44598a29f57dce4c16691c29d449 (diff)
ruleset additions
Diffstat (limited to 'exampleData/ruleSets')
-rw-r--r--exampleData/ruleSets/trac/colors.json33
-rw-r--r--exampleData/ruleSets/trac/navigation.json23
-rw-r--r--exampleData/ruleSets/trac/structure.json19
3 files changed, 61 insertions, 14 deletions
diff --git a/exampleData/ruleSets/trac/colors.json b/exampleData/ruleSets/trac/colors.json
new file mode 100644
index 0000000..2e6a2cc
--- /dev/null
+++ b/exampleData/ruleSets/trac/colors.json
@@ -0,0 +1,33 @@
+/* colorRules.json
+ *
+ * Simple rules for checking that the colors of specific elements are in a specific set.
+ * Test using exampleData/basic/testColorRules.html
+ */
+
+{ 'name': "Color Guidelines"
+, 'description': "Foreground/background color guidelines"
+, 'rules': [
+ //----------------------------------------------------------------
+ { 'name': "Foreground check"
+ , 'description': "Foreground colors should be in a certain fixed set."
+ , 'rule':
+ function () {
+ var allow = "rgb(0, 0, 0) " +
+ "rgb(255, 255, 255) " +
+ "rgb(85, 85, 85) " +
+ "rgb(34, 34, 34) " +
+ "rgb(187, 0, 0) " +
+ "rgb(238, 238, 238) " +
+ "rgb(153, 153, 136) " +
+ "rgb(136, 136, 136) " +
+ "rgb(102, 102, 102) " +
+ "rgb(187, 187, 187)".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);
+ });
+ }
+]
+}
diff --git a/exampleData/ruleSets/trac/navigation.json b/exampleData/ruleSets/trac/navigation.json
index bda8dab..f8329ab 100644
--- a/exampleData/ruleSets/trac/navigation.json
+++ b/exampleData/ruleSets/trac/navigation.json
@@ -3,6 +3,9 @@
* Author: Benjamin Jones <bjones@galois.com>
*
* Ruleset for checking the consistency of Trac navigation elements
+ *
+ * Note: the jQuery plugins .linksTo() and .idExists() haven't been
+ * written yet (1-31-2013).
*/
{ 'name': "Trac Navigation Guidelines"
@@ -14,8 +17,7 @@
, 'rule':
function() {
if ($5("a").linksTo("http://wiki.galois.com").length === 0) {
- var elt = $("body");
- report("did not find a link back to homepage", elt);
+ report("did not find a link back to homepage", $("body"));
}
}
},
@@ -24,9 +26,8 @@
, 'description': "Global navigation links should appear on every page"
, 'rule':
function() {
- if (! $5("div").idExists("topbar")) {
- var elt = $("body");
- report("could not find global navigation links", elt);
+ if (! $5("div#topbar")) {
+ report("could not find global navigation links", $("body"));
}
}
},
@@ -35,9 +36,8 @@
, 'description': "Module level navigation links should appear on every page"
, 'rule':
function() {
- if (! $5("div").idExists("mainnav")) {
- var elt = $("body");
- report("could not find module navigation links", elt);
+ if ( $5("div#mainnav").length === 0 ) {
+ report("could not find module navigation links", $("body"));
}
}
},
@@ -46,12 +46,11 @@
, 'description': "Local (context dependent) navigation links should appear on every page"
, 'rule':
function() {
- if (! $5("div").idExists("ctxtnav")) {
- var elt = $("body");
- report("could not find local (context dependent) navigation links", elt);
+ if (! $5("div#ctxtnav")) {
+ report("could not find local (context dependent) navigation links", $("body"));
}
}
- }//,
+ }
//--------------------------------------------
]
}
diff --git a/exampleData/ruleSets/trac/structure.json b/exampleData/ruleSets/trac/structure.json
index 1207241..c9931c1 100644
--- a/exampleData/ruleSets/trac/structure.json
+++ b/exampleData/ruleSets/trac/structure.json
@@ -3,6 +3,9 @@
* Author: Benjamin Jones <bjones@galois.com>
*
* Guidelines relating to structure (headings, layout, ...) of pages
+ *
+ * Note: the jQuery plugins .nonEmpty() .exists() and .cssIs() haven't
+ * been written yet (1-31-2013).
*/
{ 'name': "Structure Guidelines"
@@ -19,10 +22,22 @@
}
},
//--------------------------------------------
- { 'name': "Fluid Layouts"
- , 'description': "pages should not use a fluid layout"
+ { 'name': "Fluid DIV Layouts"
+ , 'description': "DIVs should not use a fluid layout"
+ , 'rule':
+ function() {
+ $5("body div").cssIs("layout", "fluid").each(function (i, elt) {
+ report("DIV layout should not be fluid", elt);
+ });
+ }//,
+//--------------------------------------------
+ { 'name': "Fluid Body Layouts"
+ , 'description': "Body should not use a fluid layout"
, 'rule':
function() {
+ $5("body").cssIs("layout", "fluid").each(function (i, elt) {
+ report("BODY layout should not be fluid", elt);
+ });
}//,
//--------------------------------------------
]