4 https://bugzilla.mozilla.org/show_bug.cgi?id=790475
7 <title>Test for Bug
790475</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=790475">Mozilla Bug
790475</a>
15 <div id=
"content" style=
"display: none"></div>
17 <script type=
"application/javascript">
22 * Tests that inline spell checking works properly through adjacent text nodes.
25 SimpleTest.waitForExplicitFinish();
26 addLoadEvent(runTest);
30 function getEditor() {
31 var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
32 return editingSession.getEditorForWindow(window);
35 function getSpellCheckSelection() {
36 var editor = getEditor();
37 var selcon = editor.selectionController;
38 return selcon.getSelection(selcon.SELECTION_SPELLCHECK);
43 var edit = document.getElementById(
"edit");
46 SimpleTest.executeSoon(function() {
48 is(isSpellingCheckOk(), true,
"Should not find any misspellings yet.");
50 var newTextNode = document.createTextNode(
"ing string");
51 edit.appendChild(newTextNode);
52 var editor = getEditor();
53 var sel = editor.selection;
54 sel.collapse(newTextNode, newTextNode.textContent.length);
59 SimpleTest.executeSoon(function() {
60 is(isSpellingCheckOk(), true,
"Should not have found any misspellings. ");
66 function isSpellingCheckOk() {
67 var sel = getSpellCheckSelection();
68 var numWords = sel.rangeCount;
70 is(numWords, gMisspeltWords.length,
"Correct number of misspellings and words.");
72 if (numWords != gMisspeltWords.length)
75 for (var i =
0; i < numWords; i++) {
76 var word = sel.getRangeAt(i);
77 is(word, gMisspeltWords[i],
"Misspelling is what we think it is.");
78 if (word != gMisspeltWords[i])
87 <div id=
"edit" contenteditable=
"true">This is a test
</div>