зеркало из https://github.com/electron/electron.git
test: tsify spec for experimental views api (#19966)
This commit is contained in:
Родитель
4e809f0048
Коммит
92c3a4e4c2
|
@ -16,4 +16,11 @@ declare namespace Electron {
|
|||
interface WebContents {
|
||||
getOwnerBrowserWindow(): BrowserWindow;
|
||||
}
|
||||
|
||||
// Experimental views API
|
||||
class TopLevelWindow {
|
||||
constructor(args: {show: boolean})
|
||||
setContentView(view: View): void
|
||||
}
|
||||
class View {}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { closeWindow } from './window-helpers'
|
||||
import { TopLevelWindow, View } from 'electron'
|
||||
|
||||
describe('View', () => {
|
||||
let w: TopLevelWindow
|
||||
afterEach(async () => {
|
||||
await closeWindow(w as any)
|
||||
w = null as unknown as TopLevelWindow
|
||||
})
|
||||
|
||||
it('can be used as content view', () => {
|
||||
w = new TopLevelWindow({ show: false })
|
||||
w.setContentView(new View())
|
||||
})
|
||||
})
|
|
@ -1,14 +0,0 @@
|
|||
'use strict'
|
||||
|
||||
const { closeWindow } = require('./window-helpers')
|
||||
const { TopLevelWindow, View } = require('electron').remote
|
||||
|
||||
describe('View', () => {
|
||||
let w = null
|
||||
afterEach(() => closeWindow(w).then(() => { w = null }))
|
||||
|
||||
it('can be used as content view', () => {
|
||||
w = new TopLevelWindow({ show: false })
|
||||
w.setContentView(new View())
|
||||
})
|
||||
})
|
Загрузка…
Ссылка в новой задаче