Add test for webview zoomFactor inheritance

This commit is contained in:
Kevin Sawicki 2016-05-19 14:46:11 -07:00
parent 4754e4aabb
commit b09c81202a
3 changed files with 28 additions and 0 deletions

View 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
View 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>

View file

@ -852,4 +852,19 @@ describe('<webview> tag', function () {
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')
})
})