tor-browser

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

test_spelling.html (1852B)


      1 <html>
      2 
      3 <head>
      4  <title>Spell check text attribute tests</title>
      5  <meta charset="utf-8" />
      6  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      7 
      8  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      9 
     10  <script type="application/javascript"
     11          src="../common.js"></script>
     12  <script type="application/javascript"
     13          src="../attributes.js"></script>
     14  <script type="application/javascript"
     15          src="../promisified-events.js"></script>
     16 
     17  <script type="application/javascript">
     18    async function doTest() {
     19      const misspelledAttrs = {"invalid": "spelling"};
     20 
     21      let editable = document.getElementById("div_after_misspelling");
     22      // The attr change event gets fired on the last accessible containing a
     23      // spelling error.
     24      let spellDone = waitForEvent(EVENT_TEXT_ATTRIBUTE_CHANGED, "div_after_misspelling_div2");
     25      editable.focus();
     26      await spellDone;
     27      testTextAttrs("div_after_misspelling_div1", 0, {}, {}, 0, 5, true);
     28      testTextAttrs("div_after_misspelling_div1", 5, misspelledAttrs, {}, 5, 9, true);
     29      testTextAttrs("div_after_misspelling_div2", 0, {}, {}, 0, 5, true);
     30      testTextAttrs("div_after_misspelling_div2", 5, misspelledAttrs, {}, 5, 9, true);
     31 
     32      SimpleTest.finish();
     33    }
     34 
     35    SimpleTest.waitForExplicitFinish();
     36    addA11yLoadEvent(doTest);
     37  </script>
     38 </head>
     39 <body>
     40  <p id="display"></p>
     41  <div id="content" style="display: none"></div>
     42  <pre id="test">
     43  </pre>
     44 
     45  <!-- Text attribute offsets for accessibles after first spelling error (bug 1479678) -->
     46  <div id="div_after_misspelling" contenteditable="true" spellcheck="true" lang="en-US">
     47    <div id="div_after_misspelling_div1">Test tset</div>
     48    <div id="div_after_misspelling_div2">test tset</div>
     49  </div>
     50 
     51 </body>
     52 </html>