diff options
author | Benjamin Jones <bjones@galois.com> | 2013-06-13 15:24:30 -0700 |
---|---|---|
committer | Benjamin Jones <bjones@galois.com> | 2013-06-13 15:24:30 -0700 |
commit | 8f75c6b329456b26ba1e1a86db4325db0e8998d7 (patch) | |
tree | 5a6b4c03596ed64674cff9666e84a4445459e61c /exampleData | |
parent | 032f5c5c7925f8edc4eca95b03f6fb29303b5dfb (diff) |
removed old rulesets
Diffstat (limited to 'exampleData')
-rw-r--r-- | exampleData/ruleSets/combinedFooter | 1 | ||||
-rw-r--r-- | exampleData/ruleSets/combinedHeader | 3 | ||||
-rw-r--r-- | exampleData/ruleSets/combinedRules.json | 398 | ||||
-rw-r--r-- | exampleData/ruleSets/emptyHeadings.json | 19 | ||||
-rw-r--r-- | exampleData/ruleSets/reportOnSampleText.json | 19 | ||||
-rw-r--r-- | exampleData/ruleSets/simpleRuleSet1.json | 25 | ||||
-rw-r--r-- | exampleData/ruleSets/template.json | 20 |
7 files changed, 0 insertions, 485 deletions
diff --git a/exampleData/ruleSets/combinedFooter b/exampleData/ruleSets/combinedFooter deleted file mode 100644 index 81ba4b6..0000000 --- a/exampleData/ruleSets/combinedFooter +++ /dev/null @@ -1 +0,0 @@ -]} diff --git a/exampleData/ruleSets/combinedHeader b/exampleData/ruleSets/combinedHeader deleted file mode 100644 index 4843e16..0000000 --- a/exampleData/ruleSets/combinedHeader +++ /dev/null @@ -1,3 +0,0 @@ -{ 'name': "Combined color, font, image, and text rules" -, 'description': "Site colors, fonts, images, and text should conform to these general guidelines" -, 'rules': [ diff --git a/exampleData/ruleSets/combinedRules.json b/exampleData/ruleSets/combinedRules.json deleted file mode 100644 index 0bf54ca..0000000 --- a/exampleData/ruleSets/combinedRules.json +++ /dev/null @@ -1,398 +0,0 @@ -{ 'name': "Combined color, font, image, and text rules" -, 'description': "Site colors, fonts, images, and text should conform to these general guidelines" -, 'rules': [ -// --- included from file: alwaysErrThreeTimes.json --- // - - { 'id': 112201 - , 'name': 'Reports three times' - , 'description': 'Test guideline that reports three errors' - , 'rule': - function() { - report('Problem 1 (g1)', null); - report('Problem 3 (g1)', null); - report('Problem 2 (g1)', null); - } - }, - - { 'id': 1122202 - , 'name': 'Reports two times' - , 'description': 'Test guideline that reports two errors.' - , 'rule': - function() { - report('Problem 1 (g2)', null); - report('Problem 2 (g2)', null); - } - }, -// --- included from file: basicUIRules.json --- // - - { 'id': 1001801 - , 'name': 'All input fields have exactly one label.' - , 'description': '<p>Screen readers rely on HTML attributes to identify the purpose ' - + "of form widgets on-screen. These tools use label tags with 'for' " - + 'attributes that specify the id of the form element they pertain to. ' - + 'Some of the components of this web page do not have those labels.</p>' - , 'rule': - function() { - fiveui.query(':input').each( - function(i, elt) { - if (elt.id) { - var $label = fiveui.query("label[for='" + elt.id + "']"); - - if (1 < $label.size()) { - report('Form element has too many labels', elt); - } - - if (0 == $label.size()) { - report('Form element has no label', elt); - } - } - }); - } - }, - - { 'id': 1001802 - , 'name': "Don't use empty headings." - , 'description': 'Empty headings confuse layout.' - , 'rule': - function() { - fiveui.query(':header').each( - function(i, elt) { - if ($(elt).text() == '') { - report('Heading is empty', elt); - } - }); - } - }, -// --- included from file: colorRules.json --- // - - { 'id': 2141101 - , 'name': 'Foreground check' - , 'description': 'Foreground colors should be in the set:'+ - '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738' - , 'rule': - function() { - var allow = '#00 #FF #3D #F7 #C2 #B4 #4E #FFCB05 #7B8738'.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); - }); - } - }, - - { 'id': 2141102 - , 'name': 'Background check' - , 'description': 'Backgrounds colors should be in the set:' + - '#00 #FF #3D #F7 #C2 #B4 #4E' - , 'rule': - function() { - var allow = '#00 #FF #3D #F7 #C2 #B4 #4E'.split(' '); - $5(':visible') - .cssIsNot('background-color', allow, fiveui.color.colorToHex) - .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('background-color')); - report('non-standard background color: ' + color, $(elt)); - }); - } - }, - - { 'id': 2141103 - , 'name': 'Content area color' - , 'description': 'Background color should be: ' + - '#F7' - , 'rule': - function() { - var allow = '#F7'; - $5('#content') - .cssIsNot('background-color', allow, fiveui.color.colorToHex) - .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('background-color')); - report('non-standard content background color: ' + color, elt); - }); - } - }, - - { 'id': 2141104 - , 'name': 'Left navigation color' - , 'description': 'Left navigation color should be: ' + - '#C2' - , 'rule': - function() { - var allow = '#C2'; - $5('#leftNav') - .cssIsNot('color', allow, fiveui.color.colorToHex) - .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('color')); - report('non-standard left navigation color: ' + color, elt); - }); - } - }, - - { 'id': 2141105 - , 'name': 'Header color check' - , 'description': 'Header color should be: ' + - '#3D' - , 'rule': - function() { - var allow = '#3D'; - $5(':header') - .cssIsNot('color', allow, fiveui.color.colorToHex) - .each(function(i, elt) { - var color = fiveui.color.colorToHex($(elt).css('color')); - report('non-standard header color: ' + color, elt); - }); - } - }, -// --- included from file: emptyHeadings.json --- // - - { 'id': 4121501 - , '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); - } - }); - } - }, -// --- included from file: fontRules.json --- // - - { 'id': 5141301 - , 'name': 'Font properties check' - , 'description': 'Verify that fonts (family, size, weight) are \"standard\"' - , 'rule': - function() { - var allow = { - 'Verdana': { 'bold': [25, 22, 12, 10] - , 'normal': [12, 11, 10] }}; - fiveui.query('body p,:header').each( - function(i, elt) { - var font = fiveui.font.getFont($(elt)); - if (!fiveui.font.validate(allow, font)) { - report('non-standard font: ' + - font.family + ', ' + - font.size + ', ' + - font.weight, elt); - } - }); - } - }, -// --- included from file: headingGuidelines.json --- // - - { 'id': 7040001 - , '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 capital letter', elt); - }); - - } - }, - - { 'id': 7040002 - , '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); - } - }); - } - }, -// --- included from file: imageRules.json --- // - - { 'id': 8120001 - , 'name': 'Banner check' - , 'description': 'Banner image banner.gif must appear and link to somewhere' - , 'severity': 1 - , 'rule': - function() { - var elt = $5('div[id=header]'); - var b = $5(elt).css('background'); - var l = $5('a[href]', elt).prop('href'); - if (/banner\.gif/.test(b)) { - report('banner.gif missing', elt); - } - if (l === null || l.length == 0) { - report('banner.gif link is missing', elt); - } - } - }, - - { 'id': 8120002 - , 'name': 'Image Size check' - , 'description': 'All site images should have height and width in a given set of choices' - , 'severity': 2 - , 'rule': - function() { - var allowedDimensions = { 446: { 300: {}} - , 342: { 228: {}} - , 150: { 100: {}} }; - var specialWidths = { 640: {} - , 100: {} }; - $5('img').not('div.filmstrip *') - .each(function(i, elt) { - var borderStr = /^[0-9]+/.exec($(elt).css('border')); - var border = borderStr ? parseInt(borderStr[0]) : 0; - var w = $(elt).width() + 2 * border; - var h = $(elt).height() + 2 * border; - if (!((w in specialWidths) || - (h in allowedDimensions && w in allowedDimensions[h]))) { - report('non-standard dimensions ' + h + 'x' + w, elt); - } - }); - } - }, - - { 'id': 8120003 - , 'name': 'Image Border check' - , 'description': 'All site images should have 1px solid #3D border' - , 'severity': 1 - , 'rule': - function() { - - var norm = function(s) { - if (/^\w+\s+\w+/.exec(s)) - return /^\w+\s+\w+/.exec(s)[0]; - else - return 'null null'; - }; - var imgs = $5('img').not('div.filmstrip *'); - imgs.cssIsNot('border', '1px solid', norm) - .each(function(i, elt) { - report('non-standard border style', elt); - }); - imgs.cssIsNot('border-color', '#3D3D3D', fiveui.color.colorToHex) - .each(function(i, elt) { - report('non-standard border color', elt); - }); - } - }, -// --- included from file: miscRules.json --- // - - { 'id': 12081801 - , 'name': 'Footer check' - , 'description': 'Footer should appear on the page' - , 'rule': - function() { - if ($5('div.footer').length === 0) { - report('Footer does not appear', elt); - } - } - }, - - { 'id': 12081802 - , 'name': 'Main content width check' - , 'description': 'Main content div should be between 520px and 1200px wide' - , 'rule': - function() { - var width; - var elt = $5('#content'); - if (elt) { - width = elt.width(); - if (width > 1200) { - report('Main content is too wide: ' + width, elt); - } else if (width < 520) { - report('Main content is too narrow: ' + width, elt); - } - } - } - }, -// --- included from file: reportOnSampleText.json --- // - - { 'id': 17041501 - , 'name': 'Test rule' - , 'description': 'An empty test rule' - , 'rule': function() { - fiveui.query('p').each( - function(idx, elt) { - if ($(elt).text().indexOf('Sample text') != -1) { - report('test error', elt); - } - }); - } - }, -// --- included from file: simpleRuleSet1.json --- // -// --- included from file: template.json --- // - - { 'id': 123456789 - , 'name': 'RULE NAME' - , 'description': 'RULE DESC' - , 'rule': - function() {} - }, -// --- included from file: textRules.json --- // - - { 'id': 19042301 - , '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': 19042302 - , '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); - }); - } - }, -// --- included from file: trivialReport.json --- // - - { 'id': 191708, 'name': 'Test rule', - 'description': 'An empty test rule', - 'rule': function() { report('test error'); } -} -]} diff --git a/exampleData/ruleSets/emptyHeadings.json b/exampleData/ruleSets/emptyHeadings.json deleted file mode 100644 index 3d44464..0000000 --- a/exampleData/ruleSets/emptyHeadings.json +++ /dev/null @@ -1,19 +0,0 @@ -{ 'name': 'Header Rule Set' -, 'description': 'Simple rules about HTML headers.' -, 'rules': - [ - //--- - { 'id': 4121501 - , '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/reportOnSampleText.json b/exampleData/ruleSets/reportOnSampleText.json deleted file mode 100644 index 0775bb3..0000000 --- a/exampleData/ruleSets/reportOnSampleText.json +++ /dev/null @@ -1,19 +0,0 @@ -{ 'name': 'reportOnSampleText', - 'description': 'test', - 'rules': [ -//--- - { 'id': 17041501 - , 'name': 'Test rule' - , 'description': 'An empty test rule' - , 'rule': function() { - fiveui.query('p').each( - function(idx, elt) { - if ($(elt).text().indexOf('Sample text') != -1) { - report('test error', elt); - } - }); - } - }//, - //---- - ] -} diff --git a/exampleData/ruleSets/simpleRuleSet1.json b/exampleData/ruleSets/simpleRuleSet1.json deleted file mode 100644 index 8cee916..0000000 --- a/exampleData/ruleSets/simpleRuleSet1.json +++ /dev/null @@ -1,25 +0,0 @@ -{ 'name': 'Simple Rule Set 1' -, 'description': 'A trivila rule set for experimentation.' -, 'rules': [ - //--- - { 'id': 18081201 - , 'name': 'Headings are capitalized' - , 'description': 'Check to see if all h1 headings use leading capital letters.' - , 'rule': - function() { - var badHeadings = $('h1').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 capital letter.', elt); - }); - - } - }//, -] -} diff --git a/exampleData/ruleSets/template.json b/exampleData/ruleSets/template.json deleted file mode 100644 index 43ab973..0000000 --- a/exampleData/ruleSets/template.json +++ /dev/null @@ -1,20 +0,0 @@ -/* - * template.json - * Author: Benjamin Jones <bjones@galois.com> - * - * Template ruleset containing one empty rule. - */ - -{ 'name': 'NAME' - , 'description': 'DESCRIPTION' - , 'rules': [ - //-------------------------------------------- - { 'id': 123456789 - , 'name': 'RULE NAME' - , 'description': 'RULE DESC' - , 'rule': - function() {} // Function that checks the rule - }//, - //-------------------------------------------- - ] -} |