summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_anonymous_03.js
blob: 2d251a884a04fd3bd67468a28520daaf429c6b3f (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
36
37
38
39
40
41
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test shadow DOM content in the markupview.
// Note that many features are not yet enabled, but basic listing
// of elements should be working.
const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";

add_task(async function () {
  const { inspector } = await openInspectorForURL(TEST_URL);

  const shadowHostFront = await getNodeFront("#shadow", inspector.markup);
  is(shadowHostFront.numChildren, 3, "Children of the shadow host are correct");

  await inspector.markup.expandNode(shadowHostFront);
  await waitForMultipleChildrenUpdates(inspector);

  const shadowContainer = inspector.markup.getContainer(shadowHostFront);
  const containers = shadowContainer.getChildContainers();

  info("Checking the ::before pseudo element");
  const before = containers[1].node;
  await isEditingMenuDisabled(before, inspector);

  info("Checking shadow dom children");
  const shadowRootFront = containers[0].node;
  const children = await inspector.walker.children(shadowRootFront);

  is(shadowRootFront.numChildren, 2, "Children of the shadow root are counted");
  is(children.nodes.length, 2, "Children returned from walker");

  info("Checking the <h3> shadow element");
  const shadowChild1 = children.nodes[0];
  await isEditingMenuEnabled(shadowChild1, inspector);

  info("Checking the <select> shadow element");
  const shadowChild2 = children.nodes[1];
  await isEditingMenuEnabled(shadowChild2, inspector);
});