browser/devtools/styleinspector/test/browser_computedview_matched-selectors_02.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:fabfc77debc3
1 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
2 /* Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/ */
4
5 "use strict";
6
7 // Tests for matched selector texts in the computed view
8
9 let test = asyncTest(function*() {
10 yield addTab("data:text/html,<div style='color:blue;'></div>");
11
12 info("Opening the computed view");
13 let {toolbox, inspector, view} = yield openComputedView();
14
15 info("Selecting the test node");
16 yield selectNode("div", inspector);
17
18 info("Checking the color property view");
19 let propertyView = getPropertyView(view, "color");
20 ok(propertyView, "found PropertyView for color");
21 is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors is true");
22
23 info("Expanding the matched selectors");
24 propertyView.matchedExpanded = true;
25 yield propertyView.refreshMatchedSelectors();
26
27 let span = propertyView.matchedSelectorsContainer.querySelector("span.rule-text");
28 ok(span, "Found the first table row");
29
30 let selector = propertyView.matchedSelectorViews[0];
31 ok(selector, "Found the first matched selector view");
32 });
33
34 function getPropertyView(computedView, name) {
35 let propertyView = null;
36 computedView.propertyViews.some(function(view) {
37 if (view.name == name) {
38 propertyView = view;
39 return true;
40 }
41 return false;
42 });
43 return propertyView;
44 }

mercurial