feat: add removeInsertedCSS (#16579)

This commit is contained in:
Heilig Benedek 2019-06-17 17:39:36 +02:00 committed by John Kleinschmidt
parent deebde66f9
commit 5a08522b98
8 changed files with 88 additions and 9 deletions

View file

@ -1010,6 +1010,21 @@ describe('<webview> tag', function () {
})
})
it('supports inserting CSS', async () => {
await loadWebView(webview, { src: `file://${fixtures}/pages/base-page.html` })
await webview.insertCSS('body { background-repeat: round; }')
const result = await webview.executeJavaScript('window.getComputedStyle(document.body).getPropertyValue("background-repeat")')
expect(result).to.equal('round')
})
it('supports removing inserted CSS', async () => {
await loadWebView(webview, { src: `file://${fixtures}/pages/base-page.html` })
const key = await webview.insertCSS('body { background-repeat: round; }')
await webview.removeInsertedCSS(key)
const result = await webview.executeJavaScript('window.getComputedStyle(document.body).getPropertyValue("background-repeat")')
expect(result).to.equal('repeat')
})
describe('sendInputEvent', () => {
it('can send keyboard event', async () => {
loadWebView(webview, {