michael@0: /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: "use strict"; michael@0: michael@0: // Tests to make sure that URLs are clickable in the rule view michael@0: michael@0: const TEST_URI = TEST_URL_ROOT + "doc_urls_clickable.html"; michael@0: const TEST_IMAGE = TEST_URL_ROOT + "doc_test_image.png"; michael@0: const BASE_64_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab(TEST_URI); michael@0: let {toolbox, inspector, view} = yield openRuleView(); michael@0: yield selectNodes(inspector, view); michael@0: }); michael@0: michael@0: function* selectNodes(inspector, ruleView) { michael@0: let relative1 = ".relative1"; michael@0: let relative2 = ".relative2"; michael@0: let absolute = ".absolute"; michael@0: let inline = ".inline"; michael@0: let base64 = ".base64"; michael@0: let noimage = ".noimage"; michael@0: let inlineresolved = ".inline-resolved"; michael@0: michael@0: yield selectNode(relative1, inspector); michael@0: let relativeLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(relativeLink, "Link exists for relative1 node"); michael@0: is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches"); michael@0: michael@0: yield selectNode(relative2, inspector); michael@0: let relativeLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(relativeLink, "Link exists for relative2 node"); michael@0: is(relativeLink.getAttribute("href"), TEST_IMAGE, "href matches"); michael@0: michael@0: yield selectNode(absolute, inspector); michael@0: let absoluteLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(absoluteLink, "Link exists for absolute node"); michael@0: is(absoluteLink.getAttribute("href"), TEST_IMAGE, "href matches"); michael@0: michael@0: yield selectNode(inline, inspector); michael@0: let inlineLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(inlineLink, "Link exists for inline node"); michael@0: is(inlineLink.getAttribute("href"), TEST_IMAGE, "href matches"); michael@0: michael@0: yield selectNode(base64, inspector); michael@0: let base64Link = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(base64Link, "Link exists for base64 node"); michael@0: is(base64Link.getAttribute("href"), BASE_64_URL, "href matches"); michael@0: michael@0: yield selectNode(inlineresolved, inspector); michael@0: let inlineResolvedLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(inlineResolvedLink, "Link exists for style tag node"); michael@0: is(inlineResolvedLink.getAttribute("href"), TEST_IMAGE, "href matches"); michael@0: michael@0: yield selectNode(noimage, inspector); michael@0: let noimageLink = ruleView.doc.querySelector(".ruleview-propertycontainer a"); michael@0: ok(!noimageLink, "There is no link for the node with no background image"); michael@0: }