test_bug1219928.html (2089B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1219928 5 --> 6 <head> 7 <title>Test for Bug 1219928</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1219928">Mozilla Bug 1219928</a> 13 <p id="display"></p> 14 15 <div contenteditable id="en-US" lang="en-US"> 16 <p>And here a missspelled word</p> 17 <style> 18 <!-- and here another onnee in a style comment --> 19 </style> 20 </div> 21 22 <pre id="test"> 23 <script class="testbody" type="text/javascript"> 24 25 /** Test for Bug 1219928 */ 26 /* Very simple test to check that <style> blocks are skipped in the spell check */ 27 28 var spellchecker; 29 30 SimpleTest.waitForExplicitFinish(); 31 SimpleTest.waitForFocus(function() { 32 var { maybeOnSpellCheck } = SpecialPowers.ChromeUtils.importESModule( 33 "resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs" 34 ); 35 36 var elem = document.getElementById("en-US"); 37 elem.focus(); 38 39 maybeOnSpellCheck(elem, function() { 40 var editingSession = SpecialPowers.wrap(window).docShell.editingSession; 41 var editor = editingSession.getEditorForWindow(window); 42 var selcon = editor.selectionController; 43 var sel = selcon.getSelection(selcon.SELECTION_SPELLCHECK); 44 45 is(sel.toString(), "missspelled", "one misspelled word expected: missspelled"); 46 47 spellchecker = SpecialPowers.Cu.createSpellChecker(); 48 spellchecker.setFilterType(spellchecker.FILTERTYPE_NORMAL); 49 spellchecker.InitSpellChecker(editor, false, spellCheckStarted); 50 }); 51 }); 52 53 function spellCheckStarted() { 54 var misspelledWord = spellchecker.GetNextMisspelledWord(); 55 is(misspelledWord, "missspelled", "first misspelled word expected: missspelled"); 56 57 // Without the fix, the next misspelled word was 'onnee', so we check that we don't get it. 58 misspelledWord = spellchecker.GetNextMisspelledWord(); 59 isnot(misspelledWord, "onnee", "second misspelled word should not be: onnee"); 60 61 spellchecker = ""; 62 63 SimpleTest.finish(); 64 } 65 66 </script> 67 </pre> 68 </body> 69 </html>