tor-browser

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

test_cmd_fontFace_with_empty_string.html (1095B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4 <title>Tests typing in empty paragraph after running `cmd_fontFace` with empty string</title>
      5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6 <script src="/tests/SimpleTest/EventUtils.js"></script>
      7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      8 <script>
      9 SimpleTest.waitForExplicitFinish();
     10 SimpleTest.waitForFocus(() => {
     11  document.designMode = "on";
     12  document.body.innerHTML = "<p><font face=\"monospace\">abc</font><br></p>";
     13  getSelection().collapse(document.querySelector("font").firstChild, "abc".length);
     14  document.execCommand("insertParagraph");
     15  // Calling document.execCommand("fontName", false, "") is NOOP, but HTMLEditor
     16  // accepts empty string param for cmd_fontFace.
     17  SpecialPowers.doCommand(window, "cmd_fontFace", "");
     18  document.execCommand("insertText", false, "d");
     19  is(
     20    document.querySelector("p+p").innerHTML,
     21    "d",
     22    "The typed text should not be wrapped in <font face=\"monospace\">"
     23  );
     24  document.designMode = "off";
     25  SimpleTest.finish();
     26 });
     27 </script>
     28 </head>
     29 <body></body>
     30 </html>