tor-browser

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

test_bug1704381.html (1671B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta charset="UTF-8">
      5 <title>Test for Bug 1704381</title>
      6 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7 <script src="/tests/SimpleTest/EventUtils.js"></script>
      8 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
      9 </head>
     10 <body>
     11 <textarea>abc</textarea>
     12 </body>
     13 <script>
     14 "use strict";
     15 SimpleTest.waitForExplicitFinish();
     16 
     17 SimpleTest.waitForFocus(() => {
     18  const textarea = document.querySelector("textarea");
     19  (function test_EditorBase_ToggleTextDirectionAsAction() {
     20    textarea.removeAttribute("dir");
     21    textarea.focus();
     22    let newValue;
     23    textarea.oninput = () => {
     24      textarea.scrollHeight;  // flush pending layout and run re-initializing editor synchronously
     25      newValue = textarea.value;
     26    };
     27    SpecialPowers.doCommand(window, "cmd_switchTextDirection");
     28    is(newValue, "abc",
     29      "EditorBase::ToggleTextDirectionAsAction: Getting value should be succeeded immediately after reinitializing the editor");
     30    textarea.removeAttribute("dir");
     31  })();
     32  (function test_EditorBase_NotifyEditorObservers() {
     33    textarea.focus();
     34    let newValue;
     35    textarea.oninput = () => {
     36      textarea.scrollHeight;  // flush pending layout and run re-initializing editor synchronously
     37      newValue = textarea.value;
     38    };
     39    document.execCommand("insertLineBreak");
     40    is(newValue, "\nabc",
     41      "EditorBase::NotifyEditorObservers: Getting value should be succeeded immediately after reinitializing the editor");
     42    textarea.value = "abc";
     43  })();
     44  // TODO: Cannot test EditorBase::SwitchTextDirectionTo() since it requires bidi keyboard layout activated.
     45  SimpleTest.finish();
     46 });
     47 </script>
     48 </html>