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: // Test the rule-view content michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab("data:text/html;charset=utf-8,browser_ruleview_ui.js"); michael@0: let {toolbox, inspector, view} = yield openRuleView(); michael@0: michael@0: info("Creating the test document"); michael@0: let style = "" + michael@0: "#testid {" + michael@0: " background-color: blue;" + michael@0: "}" + michael@0: ".testclass, .unmatched {" + michael@0: " background-color: green;" + michael@0: "}"; michael@0: let styleNode = addStyle(content.document, style); michael@0: content.document.body.innerHTML = "
Styled Node
" + michael@0: "
Styled Node
"; michael@0: michael@0: yield testContentAfterNodeSelection(inspector, view); michael@0: }); michael@0: michael@0: function* testContentAfterNodeSelection(inspector, ruleView) { michael@0: yield selectNode("#testid", inspector); michael@0: is(ruleView.element.querySelectorAll("#noResults").length, 0, michael@0: "After a highlight, no longer has a no-results element."); michael@0: michael@0: yield clearCurrentNodeSelection(inspector) michael@0: is(ruleView.element.querySelectorAll("#noResults").length, 1, michael@0: "After highlighting null, has a no-results element again."); michael@0: michael@0: yield selectNode("#testid", inspector); michael@0: let classEditor = ruleView.element.children[2]._ruleEditor; michael@0: is(classEditor.selectorText.querySelector(".ruleview-selector-matched").textContent, michael@0: ".testclass", ".textclass should be matched."); michael@0: is(classEditor.selectorText.querySelector(".ruleview-selector-unmatched").textContent, michael@0: ".unmatched", ".unmatched should not be matched."); michael@0: }