Add test for webview zoomFactor inheritance
This commit is contained in:
parent
4754e4aabb
commit
b09c81202a
3 changed files with 28 additions and 0 deletions
5
spec/fixtures/pages/webview-zoom-factor.html
vendored
Normal file
5
spec/fixtures/pages/webview-zoom-factor.html
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<webview nodeintegration src="zoom-factor.html"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
8
spec/fixtures/pages/zoom-factor.html
vendored
Normal file
8
spec/fixtures/pages/zoom-factor.html
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
|
const {ipcRenderer, webFrame} = require('electron')
|
||||||
|
ipcRenderer.send('pong', webFrame.getZoomFactor(), webFrame.getZoomLevel())
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -852,4 +852,19 @@ describe('<webview> tag', function () {
|
||||||
document.body.appendChild(webview)
|
document.body.appendChild(webview)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('inherits the zoomFactor of the parent window', function (done) {
|
||||||
|
w = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
zoomFactor: 1.2
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ipcMain.once('pong', function (event, zoomFactor, zoomLevel) {
|
||||||
|
assert.equal(zoomFactor, 1.2)
|
||||||
|
assert.equal(zoomLevel, 1)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.loadURL('file://' + fixtures + '/pages/webview-zoom-factor.html')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue