2018-07-10 19:43:39 +00:00
|
|
|
const chai = require('chai')
|
|
|
|
const dirtyChai = require('dirty-chai')
|
2019-10-11 17:20:08 +00:00
|
|
|
const { webFrame } = require('electron')
|
2018-07-10 19:43:39 +00:00
|
|
|
|
2018-09-13 16:10:51 +00:00
|
|
|
const { expect } = chai
|
2018-07-10 19:43:39 +00:00
|
|
|
chai.use(dirtyChai)
|
2016-01-12 02:40:23 +00:00
|
|
|
|
2016-03-25 20:03:49 +00:00
|
|
|
describe('webFrame module', function () {
|
2016-11-22 16:43:14 +00:00
|
|
|
it('supports setting the visual and layout zoom level limits', function () {
|
2019-05-20 17:04:18 +00:00
|
|
|
expect(() => {
|
2016-11-22 16:43:14 +00:00
|
|
|
webFrame.setVisualZoomLevelLimits(1, 50)
|
|
|
|
webFrame.setLayoutZoomLevelLimits(0, 25)
|
2019-05-20 17:04:18 +00:00
|
|
|
}).to.not.throw()
|
2016-11-22 16:43:14 +00:00
|
|
|
})
|
2018-07-10 19:43:39 +00:00
|
|
|
|
2019-02-08 21:38:31 +00:00
|
|
|
it('top is self for top frame', () => {
|
|
|
|
expect(webFrame.top.context).to.equal(webFrame.context)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('opener is null for top frame', () => {
|
|
|
|
expect(webFrame.opener).to.be.null()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('firstChild is null for top frame', () => {
|
|
|
|
expect(webFrame.firstChild).to.be.null()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('getFrameForSelector() does not crash when not found', () => {
|
|
|
|
expect(webFrame.getFrameForSelector('unexist-selector')).to.be.null()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('findFrameByName() does not crash when not found', () => {
|
|
|
|
expect(webFrame.findFrameByName('unexist-name')).to.be.null()
|
|
|
|
})
|
|
|
|
|
|
|
|
it('findFrameByRoutingId() does not crash when not found', () => {
|
|
|
|
expect(webFrame.findFrameByRoutingId(-1)).to.be.null()
|
|
|
|
})
|
2016-03-25 20:03:49 +00:00
|
|
|
})
|