chore: refactor browser IPC into TS and app API into TS (#16921)
* chore: refactor browser IPC into typescript * chore: refactor app.ts into Typescript * Refactors app.dock into cpp * Removes app.launcher which has not existed for 3 years * Removes 2 deprecated APIs (that have been deprecated for more than one major) * Refactors deprecate.ts as well
This commit is contained in:
parent
4ccd6d5900
commit
5790869a3f
16 changed files with 258 additions and 201 deletions
|
@ -1110,20 +1110,69 @@ describe('app module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('dock APIs', () => {
|
||||
describe('dock.setMenu()', () => {
|
||||
it('keeps references to the menu', function () {
|
||||
if (process.platform !== 'darwin') this.skip()
|
||||
const dockDescribe = process.platform === 'darwin' ? describe : describe.skip
|
||||
dockDescribe('dock APIs', () => {
|
||||
describe('dock.setMenu', () => {
|
||||
it('can be retrieved via dock.getMenu', () => {
|
||||
expect(app.dock.getMenu()).to.equal(null)
|
||||
const menu = new Menu()
|
||||
app.dock.setMenu(menu)
|
||||
expect(app.dock.getMenu()).to.equal(menu)
|
||||
})
|
||||
|
||||
it('keeps references to the menu', () => {
|
||||
app.dock.setMenu(new Menu())
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
v8Util.requestGarbageCollectionForTesting()
|
||||
})
|
||||
})
|
||||
|
||||
describe('dock.show()', () => {
|
||||
before(function () {
|
||||
if (process.platform !== 'darwin') this.skip()
|
||||
describe('dock.bounce', () => {
|
||||
it('should return -1 for unknown bounce type', () => {
|
||||
expect(app.dock.bounce('bad type')).to.equal(-1)
|
||||
})
|
||||
|
||||
it('should return a positive number for informational type', () => {
|
||||
const appHasFocus = !!BrowserWindow.getFocusedWindow()
|
||||
if (!appHasFocus) {
|
||||
expect(app.dock.bounce('informational')).to.be.at.least(0)
|
||||
}
|
||||
})
|
||||
|
||||
it('should return a positive number for critical type', () => {
|
||||
const appHasFocus = !!BrowserWindow.getFocusedWindow()
|
||||
if (!appHasFocus) {
|
||||
expect(app.dock.bounce('critical')).to.be.at.least(0)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe('dock.cancelBounce', () => {
|
||||
it('should not throw', () => {
|
||||
app.dock.cancelBounce(app.dock.bounce('critical'))
|
||||
})
|
||||
})
|
||||
|
||||
describe('dock.setBadge', () => {
|
||||
after(() => {
|
||||
app.dock.setBadge('')
|
||||
})
|
||||
|
||||
it('should not throw', () => {
|
||||
app.dock.setBadge('1')
|
||||
})
|
||||
|
||||
it('should be retrievable via getBadge', () => {
|
||||
app.dock.setBadge('test')
|
||||
expect(app.dock.getBadge()).to.equal('test')
|
||||
})
|
||||
})
|
||||
|
||||
describe('dock.show', () => {
|
||||
it('should not throw', () => {
|
||||
return app.dock.show().then(() => {
|
||||
expect(app.dock.isVisible()).to.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('returns a Promise', () => {
|
||||
|
@ -1134,6 +1183,13 @@ describe('app module', () => {
|
|||
expect(app.dock.show()).to.be.eventually.fulfilled()
|
||||
})
|
||||
})
|
||||
|
||||
describe('dock.hide', () => {
|
||||
it('should not throw', () => {
|
||||
app.dock.hide()
|
||||
expect(app.dock.isVisible()).to.equal(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('whenReady', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue