/** Test for Bug 717433 **/
SimpleTest.waitForExplicitFinish(); var content = document.getElementById("content");
// Load a subframe containing an editor with language "en". At first
// load, it will set the dictionary to en-GB or en-US. We set the other one.
// At second load, it will return the current dictionary. We can check that the
// dictionary is correctly remembered between loads.
var firstLoad = true; var expected = ""; varscript;
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, we get a random dictionary based on the language "en".
if (currentDictionary == "en-GB") {
expected = "en-US";
} else if (currentDictionary == "en-US") {
expected = "en-GB";
} else {
is(true, false, "Neither en-US nor en-GB are current");
}
spellchecker.setCurrentDictionaries([expected]).then(() => {
content.src = "http://mochi.test:8888/tests/editor/spellchecker/tests/bug717433_subframe.html?firstload=false";});
} else {
is(currentDictionary, expected, expected + " expected");
content.removeEventListener("load", loadListener);
// 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.0.31Bemerkung:
(vorverarbeitet)
¤
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.