Sort contents by id for consistent ordering
This commit is contained in:
parent
34f454a0f5
commit
a4001fbc55
1 changed files with 8 additions and 5 deletions
|
@ -36,12 +36,15 @@ describe('webContents module', function () {
|
||||||
describe('getAllWebContents() API', function () {
|
describe('getAllWebContents() API', function () {
|
||||||
it('returns an array of web contents', function (done) {
|
it('returns an array of web contents', function (done) {
|
||||||
w.webContents.on('devtools-opened', function () {
|
w.webContents.on('devtools-opened', function () {
|
||||||
assert.equal(webContents.getAllWebContents().length, 4)
|
const all = webContents.getAllWebContents().sort(function (a, b) {
|
||||||
|
return a.getId() - b.getId()
|
||||||
|
})
|
||||||
|
|
||||||
assert.equal(webContents.getAllWebContents()[0].getType(), 'remote')
|
assert.equal(all.length, 4)
|
||||||
assert.equal(webContents.getAllWebContents()[1].getType(), 'webview')
|
assert.equal(all[0].getType(), 'window')
|
||||||
assert.equal(webContents.getAllWebContents()[2].getType(), 'window')
|
assert.equal(all[1].getType(), 'window')
|
||||||
assert.equal(webContents.getAllWebContents()[3].getType(), 'window')
|
assert.equal(all[2].getType(), 'remote')
|
||||||
|
assert.equal(all[3].getType(), 'webview')
|
||||||
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue