spellcheck.js (901B)
1 function isSpellingCheckOk(aEditor, aMisspelledWords, aTodo = false) { 2 var selcon = aEditor.selectionController; 3 var sel = selcon.getSelection(selcon.SELECTION_SPELLCHECK); 4 var numWords = sel.rangeCount; 5 6 if (aTodo) { 7 todo_is( 8 numWords, 9 aMisspelledWords.length, 10 "Correct number of misspellings and words." 11 ); 12 } else { 13 is( 14 numWords, 15 aMisspelledWords.length, 16 "Correct number of misspellings and words." 17 ); 18 } 19 20 if (numWords !== aMisspelledWords.length) { 21 return false; 22 } 23 24 for (var i = 0; i < numWords; ++i) { 25 var word = String(sel.getRangeAt(i)); 26 if (aTodo) { 27 todo_is(word, aMisspelledWords[i], "Misspelling is what we think it is."); 28 } else { 29 is(word, aMisspelledWords[i], "Misspelling is what we think it is."); 30 } 31 if (word !== aMisspelledWords[i]) { 32 return false; 33 } 34 } 35 return true; 36 }