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: // Checking selector counts, matched rules and titles in the computed-view michael@0: michael@0: const {PropertyView} = devtools.require("devtools/styleinspector/computed-view"); michael@0: const TEST_URI = TEST_URL_ROOT + "doc_matched_selectors.html"; michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab(TEST_URI); michael@0: let {toolbox, inspector, view} = yield openComputedView(); michael@0: michael@0: yield selectNode("#test", inspector); michael@0: yield testMatchedSelectors(view); michael@0: }); michael@0: michael@0: function* testMatchedSelectors(view) { michael@0: info("checking selector counts, matched rules and titles"); michael@0: michael@0: is(getNode("#test"), view.viewedElement.rawNode(), michael@0: "style inspector node matches the selected node"); michael@0: michael@0: let propertyView = new PropertyView(view, "color"); michael@0: propertyView.buildMain(); michael@0: propertyView.buildSelectorContainer(); michael@0: propertyView.matchedExpanded = true; michael@0: michael@0: yield propertyView.refreshMatchedSelectors(); michael@0: michael@0: let numMatchedSelectors = propertyView.matchedSelectors.length; michael@0: is(numMatchedSelectors, 6, "CssLogic returns the correct number of matched selectors for div"); michael@0: is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors returns true"); michael@0: }