Skip to content

Commit e21ace3

Browse files
author
John Kleinschmidt
committed
Add logging to figure out failures on BrowserWindow.moveTop()
1 parent 33402d2 commit e21ace3

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

spec/api-browser-window-spec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,43 +516,46 @@ describe('BrowserWindow module', () => {
516516

517517
describe('BrowserWindow.moveTop()', () => {
518518
it('should not steal focus', async () => {
519+
console.log('should not steal focus 1')
519520
const posDelta = 50
520521
const wShownInactive = emittedOnce(w, 'show')
521522
w.showInactive()
522523
await wShownInactive
523524
assert(!w.isFocused())
524-
525+
console.log('should not steal focus 2')
525526
const otherWindow = new BrowserWindow({ show: false, title: 'otherWindow' })
526527
const otherWindowShown = emittedOnce(otherWindow, 'show')
527528
otherWindow.loadURL('data:text/html,<html><body background-color: rgba(255,255,255,0)></body></html>')
528529
otherWindow.show()
529530
await otherWindowShown
530531
assert(otherWindow.isFocused())
531-
532+
console.log('should not steal focus 3')
532533
w.moveTop()
533534
const wPos = w.getPosition()
534535
const wMoving = emittedOnce(w, 'move')
535536
w.setPosition(wPos[0] + posDelta, wPos[1] + posDelta)
536537
await wMoving
537538
assert(!w.isFocused())
538539
assert(otherWindow.isFocused())
539-
540+
console.log('should not steal focus 4')
540541
const wFocused = emittedOnce(w, 'focus')
541542
w.focus()
542543
await wFocused
543544
assert(w.isFocused())
544-
545+
console.log('should not steal focus 5')
545546
otherWindow.moveTop()
546547
const otherWindowPos = otherWindow.getPosition()
547548
const otherWindowMoving = emittedOnce(otherWindow, 'move')
548549
otherWindow.setPosition(otherWindowPos[0] + posDelta, otherWindowPos[1] + posDelta)
549550
await otherWindowMoving
550551
assert(!otherWindow.isFocused())
551552
assert(w.isFocused())
552-
553+
console.log('should not steal focus 6')
553554
await closeWindow(otherWindow, { assertSingleWindow: false }).then(() => {
555+
console.log('should not steal focus 7')
554556
assert.strictEqual(BrowserWindow.getAllWindows().length, 2) // Test window + w
555557
})
558+
console.log('should not steal focus 8')
556559
})
557560
})
558561

0 commit comments

Comments
 (0)