tenfourfox/editor/libeditor/tests/spellcheck.js
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

21 lines
594 B
JavaScript

function isSpellingCheckOk(aEditor, aMisspelledWords) {
var selcon = aEditor.selectionController;
var sel = selcon.getSelection(selcon.SELECTION_SPELLCHECK);
var numWords = sel.rangeCount;
is(numWords, aMisspelledWords.length, "Correct number of misspellings and words.");
if (numWords !== aMisspelledWords.length) {
return false;
}
for (var i = 0; i < numWords; ++i) {
var word = String(sel.getRangeAt(i));
is(word, aMisspelledWords[i], "Misspelling is what we think it is.");
if (word !== aMisspelledWords[i]) {
return false;
}
}
return true;
}