tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_markup_void_elements_xhtml.js (1236B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test void element display in the markupview.
      7 const TEST_URL = URL_ROOT + "doc_markup_void_elements.xhtml";
      8 
      9 add_task(async function () {
     10  const { inspector } = await openInspectorForURL(TEST_URL);
     11  const { win } = inspector.markup;
     12 
     13  info("check non-void element closing tag is displayed");
     14  const { editor } = await getContainerForSelector("h1", inspector);
     15  ok(
     16    !editor.elt.classList.contains("void-element"),
     17    "h1 element does not have void-element class"
     18  );
     19  Assert.notStrictEqual(
     20    !editor.elt.querySelector(".close").style.display,
     21    "none",
     22    "h1 element tag is not hidden"
     23  );
     24 
     25  info("check void element closing tag is not hidden in XHTML document");
     26  const container = await getContainerForSelector("br", inspector);
     27  ok(
     28    !container.editor.elt.classList.contains("void-element"),
     29    "br element does not have void-element class"
     30  );
     31  const closeElement = container.editor.elt.querySelector(".close");
     32  const computedStyle = win.getComputedStyle(closeElement);
     33  Assert.notStrictEqual(
     34    computedStyle.display,
     35    "none",
     36    "br closing tag is not hidden"
     37  );
     38 });