feat: promisify webContents.savePage() (#16742)
* feat: promisify webContents.savePage() * no need to make compatible w callbacks, we're breaking it * fix promise resolve type * address feedback from review * fix promise return text * update smoke test
This commit is contained in:
parent
6e7dca9082
commit
de27911661
9 changed files with 35 additions and 40 deletions
|
@ -2575,12 +2575,8 @@ describe('BrowserWindow module', () => {
|
|||
|
||||
it('should save page to disk', async () => {
|
||||
await w.loadFile(path.join(fixtures, 'pages', 'save_page', 'index.html'))
|
||||
const error = await new Promise(resolve => {
|
||||
w.webContents.savePage(savePageHtmlPath, 'HTMLComplete', function (error) {
|
||||
resolve(error)
|
||||
})
|
||||
})
|
||||
expect(error).to.be.null()
|
||||
await w.webContents.savePage(savePageHtmlPath, 'HTMLComplete')
|
||||
|
||||
assert(fs.existsSync(savePageHtmlPath))
|
||||
assert(fs.existsSync(savePageJsPath))
|
||||
assert(fs.existsSync(savePageCssPath))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue