Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | // Tests to make sure that URLs are clickable in the rule view |
michael@0 | 8 | |
michael@0 | 9 | const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html"; |
michael@0 | 10 | const TEST_IMAGE = TEST_URL_ROOT + "doc_test_image.png"; |
michael@0 | 11 | const BASE_64_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; |
michael@0 | 12 | |
michael@0 | 13 | let test = asyncTest(function*() { |
michael@0 | 14 | yield addTab(TEST_URI); |
michael@0 | 15 | let {toolbox, inspector, view} = yield openRuleView(); |
michael@0 | 16 | yield selectNodes(inspector, view); |
michael@0 | 17 | }); |
michael@0 | 18 | |
michael@0 | 19 | function* selectNodes(inspector, ruleView) { |
michael@0 | 20 | let relative1 = ".relative1"; |
michael@0 | 21 | let relative2 = ".relative2"; |
michael@0 | 22 | let absolute = ".absolute"; |
michael@0 | 23 | let inline = ".inline"; |
michael@0 | 24 | let base64 = ".base64"; |
michael@0 | 25 | let noimage = ".noimage"; |
michael@0 | 26 | let inlineresolved = ".inline-resolved"; |
michael@0 | 27 | |
michael@0 | 28 | yield selectNode(relative1, inspector); |
michael@0 | 29 | let relativeLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 30 | ok(relativeLink, "Link exists for relative1 node"); |
michael@0 | 31 | is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches"); |
michael@0 | 32 | |
michael@0 | 33 | yield selectNode(relative2, inspector); |
michael@0 | 34 | let relativeLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 35 | ok(relativeLink, "Link exists for relative2 node"); |
michael@0 | 36 | is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches"); |
michael@0 | 37 | |
michael@0 | 38 | yield selectNode(absolute, inspector); |
michael@0 | 39 | let absoluteLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 40 | ok(absoluteLink, "Link exists for absolute node"); |
michael@0 | 41 | is(absoluteLink.getAttribute("href"), TEST_IMAGE, "href matches"); |
michael@0 | 42 | |
michael@0 | 43 | yield selectNode(inline, inspector); |
michael@0 | 44 | let inlineLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 45 | ok(inlineLink, "Link exists for inline node"); |
michael@0 | 46 | is(inlineLink.getAttribute("href"), TEST_IMAGE, "href matches"); |
michael@0 | 47 | |
michael@0 | 48 | yield selectNode(base64, inspector); |
michael@0 | 49 | let base64Link = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 50 | ok(base64Link, "Link exists for base64 node"); |
michael@0 | 51 | is(base64Link.getAttribute("href"), BASE_64_URL, "href matches"); |
michael@0 | 52 | |
michael@0 | 53 | yield selectNode(inlineresolved, inspector); |
michael@0 | 54 | let inlineResolvedLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 55 | ok(inlineResolvedLink, "Link exists for style tag node"); |
michael@0 | 56 | is(inlineResolvedLink.getAttribute("href"), TEST_IMAGE, "href matches"); |
michael@0 | 57 | |
michael@0 | 58 | yield selectNode(noimage, inspector); |
michael@0 | 59 | let noimageLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); |
michael@0 | 60 | ok(!noimageLink, "There is no link for the node with no background image"); |
michael@0 | 61 | } |