test_bug366682.html (1652B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=366682 5 --> 6 <head> 7 <title>Test for Bug 366682</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" 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=366682">Mozilla Bug 366682</a> 15 <p id="display"></p> 16 <div id="content" style="display: none"> 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 366682 */ 22 23 SimpleTest.waitForExplicitFinish(); 24 addLoadEvent(runTest); 25 26 var gMisspeltWords; 27 28 function getEdit() { 29 return document.getElementById("edit"); 30 } 31 32 function editDoc() { 33 return getEdit().contentDocument; 34 } 35 36 function getEditor() { 37 var win = editDoc().defaultView; 38 var editingSession = SpecialPowers.wrap(win).docShell.editingSession; 39 return editingSession.getEditorForWindow(win); 40 } 41 42 function runTest() { 43 editDoc().body.innerHTML = "<div>errror and an other errror</div>"; 44 gMisspeltWords = ["errror", "errror"]; 45 editDoc().designMode = "on"; 46 editDoc().defaultView.focus(); 47 48 const { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule( 49 "resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs" 50 ); 51 maybeOnSpellCheck(editDoc().documentElement, evalTest); 52 } 53 54 function evalTest() { 55 ok(isSpellingCheckOk(getEditor(), gMisspeltWords), 56 "All misspellings accounted for."); 57 SimpleTest.finish(); 58 } 59 </script> 60 </pre> 61 62 <iframe id="edit" width="200" height="100" src="about:blank"></iframe> 63 64 </body> 65 </html>