add spec
This commit is contained in:
parent
b5cfa2e92d
commit
224ffe44aa
2 changed files with 34 additions and 0 deletions
20
spec/fixtures/pages/webview-origin-zoom-level.html
vendored
Normal file
20
spec/fixtures/pages/webview-origin-zoom-level.html
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<webview nodeintegration src="zoom://host1" id="view" partition="webview-temp"/>
|
||||||
|
</body>
|
||||||
|
<script>
|
||||||
|
const {ipcRenderer} = require('electron')
|
||||||
|
const view = document.getElementById('view')
|
||||||
|
const view2 = document.createElement('webview')
|
||||||
|
view.addEventListener('dom-ready', () => {
|
||||||
|
view.setZoomLevel(2.0)
|
||||||
|
view2.src = "zoom://host1"
|
||||||
|
view2.partition = "webview-temp"
|
||||||
|
document.body.appendChild(view2)
|
||||||
|
})
|
||||||
|
view2.addEventListener('dom-ready', () => {
|
||||||
|
view2.getZoomLevel((level) => {
|
||||||
|
ipcRenderer.send('webview-origin-zoom-level', level)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
|
@ -1601,5 +1601,19 @@ describe('<webview> tag', function () {
|
||||||
})
|
})
|
||||||
w.loadURL(`file://${fixtures}/pages/webview-in-page-navigate.html`)
|
w.loadURL(`file://${fixtures}/pages/webview-in-page-navigate.html`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('inherits zoom level for the origin when available', (done) => {
|
||||||
|
w = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
zoomFactor: 1.2
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ipcMain.once('webview-origin-zoom-level', (event, zoomLevel) => {
|
||||||
|
assert.equal(zoomLevel, 2.0)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
w.loadURL(`file://${fixtures}/pages/webview-origin-zoom-level.html`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue