summaryrefslogtreecommitdiffstats
path: root/dom/base/test/browser_xml_toggle.js
blob: 477db038b167bc73bad61a32203574af7af6a6ac (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
const URL = `data:text/xml,
<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>
`;

add_task(async function xml_pretty_print_toggle() {
  await BrowserTestUtils.withNewTab(URL, async function (browser) {
    await SpecialPowers.spawn(browser, [], () => {
      let summary =
        content.document.documentElement.openOrClosedShadowRoot.querySelector(
          "summary"
        );
      let details = summary.parentNode;
      ok(details.open, "Should be open");
      summary.click();
      ok(!details.open, "Should be closed");
    });
  });
});