/** Test for Bug 678842 **/
SimpleTest.waitForExplicitFinish(); var content = document.getElementById("content");
// load a subframe containing an editor with a defined unknown lang. At first
// load, it will set dictionary to en-US. At second load, it will return current
// dictionary. So, we can check, dictionary is correctly remembered between
// loads.
var doc = evt.target.contentDocument; var elem = doc.getElementById("textarea"); var editor = SpecialPowers.wrap(elem).editor;
editor.setSpellcheckUserOverride(true); var inlineSpellChecker = editor.getInlineSpellChecker(true);
const { onSpellCheck } = SpecialPowers.ChromeUtils.importESModule( "resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs"
);
onSpellCheck(elem, async function() {
let spellchecker = inlineSpellChecker.spellChecker;
let currentDictionaries = spellchecker.getCurrentDictionaries();
is(currentDictionaries.length, 1, "expected one dictionary");
let currentDictionary = currentDictionaries[0];
if (firstLoad) {
firstLoad = false;
// First time around, the dictionary defaults to the locale.
is(currentDictionary, "en-US", "unexpected lang " + currentDictionary + " instead of en-US");
// Remove the fake en-GB dictionary again, since it's otherwise picked up by later tests.
await script.sendQuery("destroy");
// This will clear the content preferences and reset "spellchecker.dictionary".
spellchecker.setCurrentDictionaries([]).then( () => {
SimpleTest.finish();
});
}
});
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.