2010-06-01 01:40:17 +04:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=484181
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 484181</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
2015-02-25 16:24:58 +03:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
2015-04-14 16:26:14 +03:00
|
|
|
<script src="spellcheck.js"></script>
|
2010-06-01 01:40:17 +04:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=484181">Mozilla Bug 484181</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
2015-02-25 16:24:58 +03:00
|
|
|
|
2010-06-01 01:40:17 +04:00
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 484181 **/
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
addLoadEvent(runTest);
|
|
|
|
|
|
|
|
var gMisspeltWords;
|
|
|
|
|
|
|
|
function getEditor() {
|
2013-09-25 21:32:20 +04:00
|
|
|
var Ci = SpecialPowers.Ci;
|
2010-06-01 01:40:17 +04:00
|
|
|
var win = window;
|
2013-09-25 21:32:20 +04:00
|
|
|
var editingSession = SpecialPowers.wrap(win).QueryInterface(Ci.nsIInterfaceRequestor)
|
2010-06-01 01:40:17 +04:00
|
|
|
.getInterface(Ci.nsIWebNavigation)
|
|
|
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIEditingSession);
|
|
|
|
return editingSession.getEditorForWindow(win);
|
|
|
|
}
|
|
|
|
|
|
|
|
function append(str) {
|
|
|
|
var edit = document.getElementById("edit");
|
|
|
|
var editor = getEditor();
|
|
|
|
var sel = editor.selection;
|
|
|
|
sel.selectAllChildren(edit);
|
|
|
|
sel.collapseToEnd();
|
|
|
|
|
|
|
|
for (var i = 0; i < str.length; ++i) {
|
|
|
|
synthesizeKey(str[i], {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function runTest() {
|
|
|
|
gMisspeltWords = ["haz", "cheezburger"];
|
|
|
|
var edit = document.getElementById("edit");
|
2011-08-12 23:12:45 +04:00
|
|
|
edit.focus();
|
|
|
|
|
2013-06-06 04:07:54 +04:00
|
|
|
SpecialPowers.Cu.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm", window);
|
|
|
|
onSpellCheck(edit, function () {
|
2015-04-14 16:26:14 +03:00
|
|
|
ok(isSpellingCheckOk(getEditor(), gMisspeltWords),
|
|
|
|
"All misspellings before editing are accounted for.");
|
2013-06-06 04:07:54 +04:00
|
|
|
|
2015-02-25 16:24:58 +03:00
|
|
|
append(" becaz I'm a lulcat!");
|
2013-06-06 04:07:54 +04:00
|
|
|
onSpellCheck(edit, function () {
|
2011-08-12 23:12:45 +04:00
|
|
|
gMisspeltWords.push("becaz");
|
2015-02-25 16:24:58 +03:00
|
|
|
gMisspeltWords.push("lulcat");
|
2015-04-14 16:26:14 +03:00
|
|
|
ok(isSpellingCheckOk(getEditor(), gMisspeltWords),
|
|
|
|
"All misspellings after typing are accounted for.");
|
2010-06-01 01:40:17 +04:00
|
|
|
|
2011-08-12 23:12:45 +04:00
|
|
|
SimpleTest.finish();
|
2013-06-06 04:07:54 +04:00
|
|
|
});
|
2010-06-01 01:40:17 +04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<div><div></div><div id="edit" contenteditable="true">I can haz cheezburger</div></div>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|