filtering out offscreen webcontents in getAllWebcontents call

This commit is contained in:
gellert 2016-07-31 22:06:34 +02:00
parent 1cd1c5e01c
commit 690ca7ec2a

View file

@ -38,14 +38,13 @@ describe('webContents module', function () {
w.webContents.on('devtools-opened', function () { w.webContents.on('devtools-opened', function () {
const all = webContents.getAllWebContents().sort(function (a, b) { const all = webContents.getAllWebContents().sort(function (a, b) {
return a.getId() - b.getId() return a.getId() - b.getId()
}) }).filter(function (wc) { return wc.getType() !== 'offscreen' })
assert.equal(all.length, 5) assert.equal(all.length, 4)
assert.equal(all[0].getType(), 'window') assert.equal(all[0].getType(), 'window')
assert.equal(all[1].getType(), 'offscreen') assert.equal(all[1].getType(), 'window')
assert.equal(all[2].getType(), 'window') assert.equal(all[2].getType(), 'remote')
assert.equal(all[3].getType(), 'remote') assert.equal(all[3].getType(), 'webview')
assert.equal(all[4].getType(), 'webview')
done() done()
}) })