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:
trop[bot]
2019-08-14 17:53:20 -07:00
committed by Shelley Vohr
parent 54e1c11b2b
commit d01a8eaa39
16 changed files with 343 additions and 29 deletions

View File

@@ -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