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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/styleinspector/test/browser_computedview_matched-selectors_01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
     1.5 +/* Any copyright is dedicated to the Public Domain.
     1.6 + http://creativecommons.org/publicdomain/zero/1.0/ */
     1.7 +
     1.8 +"use strict";
     1.9 +
    1.10 +// Checking selector counts, matched rules and titles in the computed-view
    1.11 +
    1.12 +const {PropertyView} = devtools.require("devtools/styleinspector/computed-view");
    1.13 +const TEST_URI = TEST_URL_ROOT + "doc_matched_selectors.html";
    1.14 +
    1.15 +let test = asyncTest(function*() {
    1.16 +  yield addTab(TEST_URI);
    1.17 +  let {toolbox, inspector, view} = yield openComputedView();
    1.18 +
    1.19 +  yield selectNode("#test", inspector);
    1.20 +  yield testMatchedSelectors(view);
    1.21 +});
    1.22 +
    1.23 +function* testMatchedSelectors(view) {
    1.24 +  info("checking selector counts, matched rules and titles");
    1.25 +
    1.26 +  is(getNode("#test"), view.viewedElement.rawNode(),
    1.27 +      "style inspector node matches the selected node");
    1.28 +
    1.29 +  let propertyView = new PropertyView(view, "color");
    1.30 +  propertyView.buildMain();
    1.31 +  propertyView.buildSelectorContainer();
    1.32 +  propertyView.matchedExpanded = true;
    1.33 +
    1.34 +  yield propertyView.refreshMatchedSelectors();
    1.35 +
    1.36 +  let numMatchedSelectors = propertyView.matchedSelectors.length;
    1.37 +  is(numMatchedSelectors, 6, "CssLogic returns the correct number of matched selectors for div");
    1.38 +  is(propertyView.hasMatchedSelectors, true, "hasMatchedSelectors returns true");
    1.39 +}

mercurial