summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_node_not_displayed_01.js
blob: ea4ecdfd0b8e246f5fa413b00cf4fea3ab6c5b96 (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
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Tests that nodes that are not displayed appear differently in the markup-view
// when these nodes are imported in the view.

// Note that nodes inside a display:none parent are obviously not displayed too
// but the markup-view uses css inheritance to mark those as hidden instead of
// having to visit each and every child of a hidden node. So there's no sense
// testing children nodes.

const TEST_URL = URL_ROOT + "doc_markup_not_displayed.html";
const TEST_DATA = [
  {selector: "#normal-div", isDisplayed: true},
  {selector: "head", isDisplayed: false},
  {selector: "#display-none", isDisplayed: false},
  {selector: "#hidden-true", isDisplayed: false},
  {selector: "#visibility-hidden", isDisplayed: true},
  {selector: "#hidden-via-hide-shortcut", isDisplayed: false},
];

add_task(function* () {
  let {inspector} = yield openInspectorForURL(TEST_URL);

  for (let {selector, isDisplayed} of TEST_DATA) {
    info("Getting node " + selector);
    let nodeFront = yield getNodeFront(selector, inspector);
    let container = getContainerForNodeFront(nodeFront, inspector);
    is(!container.elt.classList.contains("not-displayed"), isDisplayed,
       `The container for ${selector} is marked as displayed ${isDisplayed}`);
  }
});