Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/ */
5 "use strict";
7 // Checking selector counts, matched rules and titles in the computed-view
9 const {PropertyView} = devtools.require("devtools/styleinspector/computed-view");
10 const TEST_URI = TEST_URL_ROOT + "doc_matched_selectors.html";
12 let test = asyncTest(function*() {
13 yield addTab(TEST_URI);
14 let {toolbox, inspector, view} = yield openComputedView();
16 yield selectNode("#test", inspector);
17 yield testMatchedSelectors(view);
18 });
20 function* testMatchedSelectors(view) {
21 info("checking selector counts, matched rules and titles");
23 is(getNode("#test"), view.viewedElement.rawNode(),
24 "style inspector node matches the selected node");
26 let propertyView = new PropertyView(view, "color");
27 propertyView.buildMain();
28 propertyView.buildSelectorContainer();
29 propertyView.matchedExpanded = true;
31 yield propertyView.refreshMatchedSelectors();
33 let numMatchedSelectors = propertyView.matchedSelectors.length;
34 is(numMatchedSelectors, 6, "CssLogic returns the correct number of matched selectors for div");
35 is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors returns true");
36 }