feat: add removeInsertedCSS (#16579)
This commit is contained in:
parent
deebde66f9
commit
5a08522b98
8 changed files with 88 additions and 9 deletions
|
@ -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() })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue