aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/headingGuidelines.json
blob: d4092085c6e285f435fde16e63c1af8d6a0e5e58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ 'name': 'Heading Guidelines'
, 'description': 'Guidelines pertaining to the formatting and content of headings'
, 'rules': [
//------------
  { '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);
          }
        });
    }
  }//,
//------------
]
}