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

@ -515,11 +515,19 @@ describe('webContents module', () => {
it('supports inserting CSS', async () => {
w.loadURL('about:blank')
w.webContents.insertCSS('body { background-repeat: round; }')
await w.webContents.insertCSS('body { background-repeat: round; }')
const result = await w.webContents.executeJavaScript('window.getComputedStyle(document.body).getPropertyValue("background-repeat")')
expect(result).to.equal('round')
})
it('supports removing inserted CSS', async () => {
w.loadURL('about:blank')
const key = await w.webContents.insertCSS('body { background-repeat: round; }')
await w.webContents.removeInsertedCSS(key)
const result = await w.webContents.executeJavaScript('window.getComputedStyle(document.body).getPropertyValue("background-repeat")')
expect(result).to.equal('repeat')
})
it('supports inspecting an element in the devtools', (done) => {
w.loadURL('about:blank')
w.webContents.once('devtools-opened', () => { done() })