summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/computed/test/browser_computed_media-queries.js
blob: e33da9c528be15b2a17ff44f7e159392e78835ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Tests that we correctly display appropriate media query titles in the
// property view.

const TEST_URI = URL_ROOT + "doc_media_queries.html";

var {PropertyView} = require("devtools/client/inspector/computed/computed");

add_task(function* () {
  yield addTab(TEST_URI);
  let {inspector, view} = yield openComputedView();
  yield selectNode("div", inspector);
  yield checkPropertyView(view);
});

function checkPropertyView(view) {
  let propertyView = new PropertyView(view, "width");
  propertyView.buildMain();
  propertyView.buildSelectorContainer();
  propertyView.matchedExpanded = true;

  return propertyView.refreshMatchedSelectors().then(() => {
    let numMatchedSelectors = propertyView.matchedSelectors.length;

    is(numMatchedSelectors, 2,
        "Property view has the correct number of matched selectors for div");

    is(propertyView.hasMatchedSelectors, true,
        "hasMatchedSelectors returns true");
  });
}