tor-browser

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

test_bug432225.html (1712B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=432225
      5 -->
      6 <head>
      7  <title>Test for Bug 432225</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <script src="/tests/SimpleTest/EventUtils.js"></script>
     11  <script src="spellcheck.js"></script>
     12 </head>
     13 <body>
     14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=432225">Mozilla Bug 432225</a>
     15 <p id="display"></p>
     16 <div id="content" style="display: none">
     17 
     18 </div>
     19 <pre id="test">
     20 <script type="application/javascript">
     21 
     22 /** Test for Bug 432225 */
     23 
     24 let { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule(
     25  "resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
     26 );
     27 
     28 SimpleTest.waitForExplicitFinish();
     29 addLoadEvent(runTest);
     30 
     31 var gMisspeltWords = [];
     32 
     33 function getEdit() {
     34  return document.getElementById("edit");
     35 }
     36 
     37 function editDoc() {
     38  return getEdit().contentDocument;
     39 }
     40 
     41 function getEditor() {
     42  var win = editDoc().defaultView;
     43  var editingSession = SpecialPowers.wrap(win).docShell.editingSession;
     44  return editingSession.getEditorForWindow(win);
     45 }
     46 
     47 function runTest() {
     48  editDoc().designMode = "on";
     49  setTimeout(function() { addWords(100); }, 0);
     50 }
     51 
     52 function addWords(aLimit) {
     53  if (aLimit == 0) {
     54    ok(isSpellingCheckOk(getEditor(), gMisspeltWords),
     55       "All misspellings accounted for.");
     56    SimpleTest.finish();
     57    return;
     58  }
     59  getEdit().focus();
     60  sendString("aa OK ");
     61  gMisspeltWords.push("aa");
     62  maybeOnSpellCheck(editDoc(), function() {
     63    addWords(aLimit - 1);
     64  });
     65 }
     66 </script>
     67 </pre>
     68 
     69 <iframe id="edit" width="200" height="100" src="about:blank"></iframe>
     70 
     71 </body>
     72 </html>