mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: add new nativeTheme API (#19758)
* feat: add new nativeTheme API * chore: deprecate and clean up old systemPreferences theme APIs in favor of new nativeTheme module * chore: clean up and deprecate things per feedback * chore: add tests for deprecate and clean up invert impl * build: when is a boolean not a boolean???
This commit is contained in:
@@ -168,6 +168,37 @@ describe('deprecate', () => {
|
||||
expect(warnings[1]).to.include(newProp)
|
||||
})
|
||||
|
||||
describe('moveAPI', () => {
|
||||
beforeEach(() => {
|
||||
deprecate.setHandler(null)
|
||||
})
|
||||
|
||||
it('should call the original method', () => {
|
||||
const warnings = []
|
||||
deprecate.setHandler(warning => warnings.push(warning))
|
||||
|
||||
let called = false
|
||||
const fn = () => {
|
||||
called = true
|
||||
}
|
||||
const deprecated = deprecate.moveAPI(fn, 'old', 'new')
|
||||
deprecated()
|
||||
expect(called).to.equal(true)
|
||||
})
|
||||
|
||||
it('should log the deprecation warning once', () => {
|
||||
const warnings = []
|
||||
deprecate.setHandler(warning => warnings.push(warning))
|
||||
|
||||
const deprecated = deprecate.moveAPI(() => null, 'old', 'new')
|
||||
deprecated()
|
||||
expect(warnings).to.have.lengthOf(1)
|
||||
deprecated()
|
||||
expect(warnings).to.have.lengthOf(1)
|
||||
expect(warnings[0]).to.equal('\'old\' is deprecated and will be removed. Please use \'new\' instead.')
|
||||
})
|
||||
})
|
||||
|
||||
describe('promisify', () => {
|
||||
const expected = 'Hello, world!'
|
||||
let promiseFunc
|
||||
|
||||
Reference in New Issue
Block a user