Add debugging for TAB tests

This commit is contained in:
John Kleinschmidt
2020-03-16 14:25:11 -04:00
parent c18887e8fc
commit af393c1b0b
2 changed files with 13 additions and 0 deletions

View File

@@ -119,8 +119,14 @@ describe('focus handling', () => {
w = null as unknown as BrowserWindow
})
ipcMain.on('console-log', (event, test) => {
console.log('Console-log: ', test)
})
const expectFocusChange = async () => {
console.log('About to await focus-changed')
const [, focusedElementId] = await emittedOnce(ipcMain, 'focus-changed')
console.log('Got focus-changed event:', focusedElementId)
return focusedElementId
}

View File

@@ -10,7 +10,14 @@
if (event.target.tagName && event.target.tagName !== 'WEBVIEW') {
const elementId = event.target.id ? `-${event.target.id}` : ''
const elementIdentifier = `${event.target.tagName}${elementId}`
ipcRenderer.send('console-log', `sending focus-changed event for ${elementIdentifier}`)
ipcRenderer.send('focus-changed', elementIdentifier)
} else {
if (event.target.tagName) {
ipcRenderer.send('console-log', `GOT focus event, but tagname "${event.target.tagName}" not expected.`)
} else {
ipcRenderer.send('console-log', `GOT focus event, but do not have tagname.`)
}
}
}