aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exampleData/basic/star.gifbin0 -> 39703 bytes
-rw-r--r--exampleData/basic/star.jpegbin0 -> 6194 bytes
-rw-r--r--exampleData/basic/testColorRules.html24
-rw-r--r--exampleData/basic/testImageRules.html31
-rw-r--r--exampleData/basic/test_template.html19
-rw-r--r--exampleData/ruleSets/colorRules.json53
-rw-r--r--exampleData/ruleSets/imageRules.json34
-rw-r--r--exampleData/ruleSets/template.json32
8 files changed, 193 insertions, 0 deletions
diff --git a/exampleData/basic/star.gif b/exampleData/basic/star.gif
new file mode 100644
index 0000000..30bcb1a
--- /dev/null
+++ b/exampleData/basic/star.gif
Binary files differ
diff --git a/exampleData/basic/star.jpeg b/exampleData/basic/star.jpeg
new file mode 100644
index 0000000..026306b
--- /dev/null
+++ b/exampleData/basic/star.jpeg
Binary files differ
diff --git a/exampleData/basic/testColorRules.html b/exampleData/basic/testColorRules.html
new file mode 100644
index 0000000..9faeae0
--- /dev/null
+++ b/exampleData/basic/testColorRules.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+<body>
+<h1>Color tests</h1>
+<p style="color: #FFFFF1">This (almost) is an FF paragraph.</p>
+<p style="color: #CCCCCC">This is an CC paragraph.</p>
+<p style="color: #3D3D3D">This is an 3D paragraph.</p>
+<p style="color: #000000">This is an 00 paragraph.</p>
+<hr>
+<p style="color: #3D3D3D; background-color: #C2C2C2">This is a paragraph with OK bg color</p>
+<p style="color: #3D3D3D; background-color: #CCCC00">This is a paragraph with BAD bg color</p>
+<hr>
+<div id="content" style="color: #F7F7F7">
+ This is a DIV ID=content
+</div>
+random text here
+<div id="content" style="color: #C7C7C7">
+ This is a DIV ID=content with bad colors!
+</div>
+</body>
+</html>
+
+
diff --git a/exampleData/basic/testImageRules.html b/exampleData/basic/testImageRules.html
new file mode 100644
index 0000000..66c3772
--- /dev/null
+++ b/exampleData/basic/testImageRules.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+ .test{ border: 3px inset red; }
+ </style>
+ </head>
+<body>
+<h1>this is a heading</h1>
+<p>
+We need a star.gif somewhere!?
+</p>
+<h2>Images</h2>
+An example, this one should pass:
+
+<p>
+<a href="http://star.org">
+<img src="star.jpeg">
+</a>
+<p>
+<a href="googles.com">This link has no image.</a>
+<p>
+A non-example, this one should fail:
+
+<a href="http://www.cnn.com">
+<img src="star.jpeg">
+</a>
+</body>
+</html>
+
+
diff --git a/exampleData/basic/test_template.html b/exampleData/basic/test_template.html
new file mode 100644
index 0000000..7adadc3
--- /dev/null
+++ b/exampleData/basic/test_template.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+<body>
+<h1>this heading is not BOB</h1>
+<p>
+Sample text
+</p>
+<h2>BOB</h2>
+<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/colorRules.json b/exampleData/ruleSets/colorRules.json
new file mode 100644
index 0000000..5dfb7ca
--- /dev/null
+++ b/exampleData/ruleSets/colorRules.json
@@ -0,0 +1,53 @@
+{ 'name': "Colors are in a specified set"
+, 'description': "All background and foreground colors used on a page should be in a specificed set"
+, 'rules': [
+ { 'image-appears': "Foregrounds"
+ , 'description': "Foreground colors are in a specified set"
+ , 'rule':
+ function() { //----------------------------------------------
+ var allowableColors = { '#0': 1, '#FFFFFF': 1, '#3D3D3D': 1,
+ '#B4B4B4': 1, '#4E4E4E': 1, '#C2C2C2': 1,
+ '#F7F7F7': 1 };
+ fiveui.query(':visible').each(
+ function(i, elt) {
+ var color = $(elt).css('color');
+ // console.log('color: ' + color + ' --> ' + fiveui.colorToHex(color));
+ if (!(fiveui.colorToHex(color) in allowableColors)) {
+ report('Disallowed FOREground color appears');
+ }
+ });
+ } //---------------------------------------------------------
+ },//==============================================================
+ { 'image-appears': "Backgrounds"
+ , 'description': "Backgrounds colors are in a specified set"
+ , 'rule':
+ function() { //----------------------------------------------
+ var allowableColors = { '#0': 1, '#FFFFFF': 1,
+ '#3D3D3D': 1, '#B4B4B4': 1, '#4E4E4E': 1,
+ '#C2C2C2': 1 };
+ fiveui.query(':visible').each(
+ function(i, elt) {
+ var color = $(elt).css('background-color');
+ if (!(fiveui.colorToHex(color) in allowableColors)) {
+ report('Disallowed BACKground color appears');
+ }
+ });
+ } //---------------------------------------------------------
+ },//==============================================================
+ { 'image-appears': "Content Area Color"
+ , 'description': "Content Area Color is #F7"
+ , 'rule':
+ //----------
+ function() {
+ var allowableColors = { '#F7F7F7': 1 };
+ fiveui.query("div[id='content'").each(
+ function(i, elt) {
+ var color = $(elt).css('color');
+ if (!(fiveui.colorToHex(color) in allowableColors)) {
+ report('Invalid color in content area');
+ }
+ });
+ } //---------------------------------------------------------
+ } //==============================================================
+ ]
+}
diff --git a/exampleData/ruleSets/imageRules.json b/exampleData/ruleSets/imageRules.json
new file mode 100644
index 0000000..0ba8f77
--- /dev/null
+++ b/exampleData/ruleSets/imageRules.json
@@ -0,0 +1,34 @@
+{ 'name': "Image exists and links back to URL"
+, 'description': "A specific image file should be included in the page and link back to a specific URL"
+, 'rules': [
+ { 'image-appears': "Image appears on page"
+ , 'description': "A specific image should appear somewhere on the page."
+ , 'rule':
+ function() {
+ var flag = false;
+ fiveui.query("img[src$='star.jpeg']").each(function(i, elt) { flag = true; });
+ if (!flag) {
+ report('Image star.gif does not appear');
+ }
+ }
+ },
+ { 'image-links-back': "Image links back"
+ , 'description': "Each instance of a specific image must link back to a specific URL"
+ , 'rule':
+ function() {
+ fiveui.query('a').has('img').each(
+ function(i, elt) {
+ fiveui.query('img', elt).each(
+ function(j, elt2) {
+ if (/star.jpeg$/.test(elt2['src']) && !/star/.test(elt['href'])) {
+ report('Image star.jpeg does not link back to google');
+ }
+ }
+ );
+ }
+ );
+ }
+ }
+ ]
+}
+
diff --git a/exampleData/ruleSets/template.json b/exampleData/ruleSets/template.json
new file mode 100644
index 0000000..6a5a886
--- /dev/null
+++ b/exampleData/ruleSets/template.json
@@ -0,0 +1,32 @@
+{ 'name': "Colors are in a specified set"
+, 'description': "All background and foreground colors used on a page should be in a specificed set"
+, 'rules': [
+ { 'image-appears': "Foregrounds"
+ , 'description': "Foreground colors are in a specified set"
+ , 'rule':
+ function() {
+ var allowableColors = [ '#000000', '#FFFFFF', '#3D3D3D', '#B4B4B4', '#4E4E4E', '#C2C2C2' ];
+ fiveui.query('').each(
+ function(i, elt) {
+ if ($(elt).css('color') in allowableColors) {
+ $(elt).addClass('reportColor');
+ }
+ });
+ }
+ },
+ { 'image-appears': "Backgrounds"
+ , 'description': "Backgrounds colors are in a specified set"
+ , 'rule':
+ function() {
+ var allowableColors = [ 'transparent', '#000000', '#FFFFFF', '#3D3D3D', '#B4B4B4', '#4E4E4E', '#C2C2C2' ];
+ fiveui.query('').each(
+ function(i, elt) {
+ if ($(elt).css('color') in allowableColors) {
+ $(elt).addClass('reportBackColor');
+ }
+ });
+ }
+ }
+
+ ]
+}