blob: 924d750bb19b3cfb04072559704f821335c965c8 (
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
42
43
44
|
/*
* imageRules.json
* Author: Benjamin Jones <bjones@galois.com>
*
* Simple rules for checking that specific images appear on a page and that specific images
* link back to specific URLs.
*
* Test using exampleData/basic/testImageRules.html
*/
{ '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');
}
}
);
}
);
}
}
]
}
|