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 for matched selector texts in the computed view michael@0: michael@0: let test = asyncTest(function*() { michael@0: yield addTab("data:text/html,
"); michael@0: michael@0: info("Opening the computed view"); michael@0: let {toolbox, inspector, view} = yield openComputedView(); michael@0: michael@0: info("Selecting the test node"); michael@0: yield selectNode("div", inspector); michael@0: michael@0: info("Checking the color property view"); michael@0: let propertyView = getPropertyView(view, "color"); michael@0: ok(propertyView, "found PropertyView for color"); michael@0: is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors is true"); michael@0: michael@0: info("Expanding the matched selectors"); michael@0: propertyView.matchedExpanded = true; michael@0: yield propertyView.refreshMatchedSelectors(); michael@0: michael@0: let span = propertyView.matchedSelectorsContainer.querySelector("span.rule-text"); michael@0: ok(span, "Found the first table row"); michael@0: michael@0: let selector = propertyView.matchedSelectorViews[0]; michael@0: ok(selector, "Found the first matched selector view"); michael@0: }); michael@0: michael@0: function getPropertyView(computedView, name) { michael@0: let propertyView = null; michael@0: computedView.propertyViews.some(function(view) { michael@0: if (view.name == name) { michael@0: propertyView = view; michael@0: return true; michael@0: } michael@0: return false; michael@0: }); michael@0: return propertyView; michael@0: }