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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests to make sure that URLs are clickable in the rule view
const TEST_URI = URL_ROOT_SSL + "doc_urls_clickable.html";
const TEST_IMAGE = URL_ROOT_SSL + "doc_test_image.png";
const BASE_64_URL =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAA" +
"FCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAA" +
"BJRU5ErkJggg==";
add_task(async function () {
await addTab(TEST_URI);
const { inspector, view } = await openRuleView();
await selectNodes(inspector, view);
});
async function selectNodes(inspector, ruleView) {
const relative1 = ".relative1";
const relative2 = ".relative2";
const absolute = ".absolute";
const inline = ".inline";
const base64 = ".base64";
const noimage = ".noimage";
const inlineresolved = ".inline-resolved";
await selectNode(relative1, inspector);
let relativeLink = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(relativeLink, "Link exists for relative1 node");
is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches");
await selectNode(relative2, inspector);
relativeLink = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(relativeLink, "Link exists for relative2 node");
is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches");
await selectNode(absolute, inspector);
const absoluteLink = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(absoluteLink, "Link exists for absolute node");
is(absoluteLink.getAttribute("href"), TEST_IMAGE, "href matches");
await selectNode(inline, inspector);
const inlineLink = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(inlineLink, "Link exists for inline node");
is(inlineLink.getAttribute("href"), TEST_IMAGE, "href matches");
await selectNode(base64, inspector);
const base64Link = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(base64Link, "Link exists for base64 node");
is(base64Link.getAttribute("href"), BASE_64_URL, "href matches");
await selectNode(inlineresolved, inspector);
const inlineResolvedLink = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(inlineResolvedLink, "Link exists for style tag node");
is(inlineResolvedLink.getAttribute("href"), TEST_IMAGE, "href matches");
await selectNode(noimage, inspector);
const noimageLink = ruleView.styleDocument.querySelector(
".ruleview-propertyvaluecontainer a"
);
ok(!noimageLink, "There is no link for the node with no background image");
}
|