tor-browser

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

test_bug1602526.html (1677B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <title>Mozilla bug 1602526</title>
      5  <link rel=stylesheet href="/tests/SimpleTest/test.css">
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <script src="/tests/editor/spellchecker/tests/spellcheck.js"></script>
      9 </head>
     10 <body>
     11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1602526">Mozilla Bug 1602526</a>
     12 <p id="display"></p>
     13 <div id="content" style="display: none;">
     14 
     15 </div>
     16 
     17 <div id="contenteditable" contenteditable=true>kkkk&#xf6;kkkk</div>
     18 
     19 <script>
     20 const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
     21  "resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
     22 );
     23 
     24 SimpleTest.waitForExplicitFinish();
     25 
     26 function getEditor() {
     27  return SpecialPowers.wrap(window).docShell.editor;
     28 }
     29 
     30 SimpleTest.waitForFocus(async () => {
     31  let contenteditable = document.getElementById("contenteditable");
     32  let misspeltWords = [];
     33  misspeltWords.push("kkkk\u00f6kkkk");
     34 
     35  contenteditable.focus();
     36  window.getSelection().collapse(contenteditable.firstChild, contenteditable.firstChild.length);
     37 
     38  synthesizeKey(" ");
     39 
     40  // Run spell checker
     41  await new Promise((resolve) => { maybeOnSpellCheck(contenteditable, resolve); });
     42 
     43  synthesizeKey("a");
     44  synthesizeKey("a");
     45  synthesizeKey("a");
     46 
     47  await new Promise((resolve) => { maybeOnSpellCheck(contenteditable, resolve); });
     48  let editor = getEditor();
     49  // isSpellingCheckOk is defined in spellcheck.js
     50  // eslint-disable-next-line no-undef
     51  ok(isSpellingCheckOk(editor, misspeltWords), "correct word is seleced as misspell");
     52 
     53  SimpleTest.finish();
     54 });
     55 </script>
     56 </body>
     57 </html>