add basic webview zoom specs
This commit is contained in:
parent
c71b44048c
commit
403e7681c1
4 changed files with 66 additions and 19 deletions
23
spec/fixtures/pages/webview-custom-zoom-level.html
vendored
Normal file
23
spec/fixtures/pages/webview-custom-zoom-level.html
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
<html>
|
||||
<body>
|
||||
<webview nodeintegration src="a.html" id="view"/>
|
||||
</body>
|
||||
<script>
|
||||
const {ipcRenderer, webFrame} = require('electron')
|
||||
const view = document.getElementById('view')
|
||||
let finalNavigation = false
|
||||
view.addEventListener('dom-ready', () => {
|
||||
if (!finalNavigation)
|
||||
view.setZoomLevel(2.0)
|
||||
view.getZoomLevel((zoomLevel) => {
|
||||
view.getZoomFactor((zoomFactor) => {
|
||||
ipcRenderer.send('webview-zoom-level', zoomLevel, zoomFactor, finalNavigation)
|
||||
if (!finalNavigation) {
|
||||
finalNavigation = true
|
||||
view.src = 'b.html'
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue