feat: Spellchecker Async Implementation (#14032)
* feat:Spellchecker Async Implementation * Adhere to chromium style * Updating dependency to use gh branch * Update docs and electron-typescript-definitions module * Fix lint * Update electron typescript definitions version * Update spec * Address review
This commit is contained in:
parent
4bbb70de74
commit
a9ca152069
9 changed files with 142 additions and 112 deletions
|
@ -152,12 +152,22 @@ describe('webFrame module', function () {
|
|||
w.focus()
|
||||
await w.webContents.executeJavaScript('document.querySelector("input").focus()', true)
|
||||
|
||||
const spellCheckerFeedback = emittedOnce(ipcMain, 'spec-spell-check')
|
||||
const misspelledWord = 'spleling'
|
||||
for (const keyCode of [...misspelledWord, ' ']) {
|
||||
const spellCheckerFeedback =
|
||||
new Promise((resolve, reject) => {
|
||||
ipcMain.on('spec-spell-check', (e, words, callback) => {
|
||||
if (words.length === 2) {
|
||||
// The promise is resolved only after this event is received twice
|
||||
// Array contains only 1 word first time and 2 the next time
|
||||
resolve([words, callback])
|
||||
}
|
||||
})
|
||||
})
|
||||
const inputText = 'spleling test '
|
||||
for (const keyCode of inputText) {
|
||||
w.webContents.sendInputEvent({ type: 'char', keyCode })
|
||||
}
|
||||
const [, text] = await spellCheckerFeedback
|
||||
expect(text).to.equal(misspelledWord)
|
||||
const [words, callback] = await spellCheckerFeedback
|
||||
expect(words).to.deep.equal(['spleling', 'test'])
|
||||
expect(callback).to.be.true()
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue