summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_toggle_04.js
blob: 9dceb9745ee60416fbe2c3ebee7a3b28c29efb26 (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
/* Any copyright is dedicated to the Public Domain.
 http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Test expanding elements by clicking on expand badge.

const TEST_URL = URL_ROOT + "doc_markup_toggle.html";

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

  info("Getting the container for the UL parent element");
  const container = await getContainerForSelector("ul", inspector);
  ok(!container.mustExpand, "UL element !mustExpand");
  ok(container.canExpand, "UL element canExpand");

  info("Clicking on the UL parent expand badge, and waiting for children");
  const onChildren = waitForChildrenUpdated(inspector);
  const onUpdated = inspector.once("inspector-updated");

  EventUtils.synthesizeMouseAtCenter(
    container.editor.expandBadge,
    {},
    inspector.markup.doc.defaultView
  );
  await onChildren;
  await onUpdated;

  info("Checking that child LI elements have been created");
  const numLi = await getNumberOfMatchingElementsInContentPage("li");
  for (let i = 0; i < numLi; i++) {
    const liContainer = await getContainerForSelector(
      `li:nth-child(${i + 1})`,
      inspector
    );
    ok(liContainer, "A container for the child LI element was created");
  }
  ok(container.expanded, "Parent UL container is expanded");
});