Add systemPreferences.removeUserDefault()
This can be used to restore the default or global value of a `key` previously set with `setUserDefault`.
This commit is contained in:
parent
30abdbccf8
commit
06d782279c
5 changed files with 35 additions and 4 deletions
|
@ -100,6 +100,23 @@ describe('systemPreferences module', function () {
|
|||
})
|
||||
})
|
||||
|
||||
describe('systemPreferences.setUserDefault(key, type, value)', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
return
|
||||
}
|
||||
|
||||
it('removes keys', () => {
|
||||
const KEY = 'SystemPreferencesTest'
|
||||
systemPreferences.setUserDefault(KEY, 'string', 'foo')
|
||||
systemPreferences.removeUserDefault(KEY)
|
||||
assert.equal(systemPreferences.getUserDefault(KEY, 'string'), '')
|
||||
})
|
||||
|
||||
it('does not throw for missing keys', () => {
|
||||
systemPreferences.removeUserDefault('some-missing-key')
|
||||
})
|
||||
})
|
||||
|
||||
describe('systemPreferences.isInvertedColorScheme()', function () {
|
||||
it('returns a boolean', function () {
|
||||
assert.equal(typeof systemPreferences.isInvertedColorScheme(), 'boolean')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue