summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/spellcheck.js
diff options
context:
space:
mode:
Diffstat (limited to 'editor/libeditor/tests/spellcheck.js')
-rw-r--r--editor/libeditor/tests/spellcheck.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/editor/libeditor/tests/spellcheck.js b/editor/libeditor/tests/spellcheck.js
new file mode 100644
index 000000000..9d36c3254
--- /dev/null
+++ b/editor/libeditor/tests/spellcheck.js
@@ -0,0 +1,20 @@
+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;
+}