<!doctype html><html><!--https://bugzilla.mozilla.org/show_bug.cgi?id=1729653--><head><metacharset="utf-8"><title>Test for Bug 1729653</title><scriptsrc="/tests/SimpleTest/SimpleTest.js"></script><scriptsrc="/tests/SimpleTest/EventUtils.js"></script><linkrel="stylesheet"href="/tests/SimpleTest/test.css"></head><body><textarearows="20"cols="50">That undfgdfg seems OK.</textarea><script>let{maybeOnSpellCheck}=SpecialPowers.ChromeUtils.importESModule("resource://testing-common/AsyncSpellCheckTestHelper.sys.mjs");functionwaitForTick(){returnnewPromise(resolve=>SimpleTest.executeSoon(resolve));}functionwaitForOnSpellCheck(aTextArea){info("Waiting for onSpellCheck...");returnnewPromise(resolve=>maybeOnSpellCheck(aTextArea,resolve));}/** Test for Bug 1729653 **/SimpleTest.waitForExplicitFinish();SimpleTest.waitForFocus(async()=>{consttextarea=document.querySelector("textarea");textarea.focus();textarea.selectionStart=textarea.selectionEnd="That undfgdfg".length;consteditor=SpecialPowers.wrap(textarea).editor;constnsISelectionController=SpecialPowers.Ci.nsISelectionController;constselection=editor.selectionController.getSelection(nsISelectionController.SELECTION_SPELLCHECK);constspellChecker=SpecialPowers.Cu.createSpellChecker();spellChecker.InitSpellChecker(editor,false);info("Waiting for current dictionary update...");awaitnewPromise(resolve=>spellChecker.UpdateCurrentDictionary(resolve));if(selection.rangeCount===0){awaitwaitForOnSpellCheck(textarea);}if(selection.rangeCount==1){is(selection.getRangeAt(0).toString(),"undfgdfg","\"undfgdfg\" should be marked as misspelled word at start");}else{is(selection.rangeCount,1,"We should have a misspelled word at start");}synthesizeKey(" ");synthesizeKey("KEY_Backspace");textarea.addEventListener("keydown",event=>{event.stopImmediatePropagation();// This shouldn't block spellchecker to handle it.},{once:true});synthesizeKey("KEY_End");awaitwaitForTick();if(selection.rangeCount===0){awaitwaitForOnSpellCheck(textarea);}if(selection.rangeCount==1){is(selection.getRangeAt(0).toString(),"undfgdfg","\"undfgdfg\" should be marked as misspelled word at end");}else{is(selection.rangeCount,1,"We should have a misspelled word at end");}SimpleTest.finish();});</script></body></html>