mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Setting value to null/undefined removes key from config
This commit is contained in:
committed by
Corey Johnson & Kevin Sawicki
parent
c923b561e2
commit
1b98bf706e
@@ -100,6 +100,11 @@ describe "Config", ->
|
||||
config.set('foo.bar.baz', "value 1")
|
||||
expect(observeHandler).toHaveBeenCalledWith("value 1")
|
||||
|
||||
it "fires the callback when the observed value is deleted", ->
|
||||
observeHandler.reset() # clear the initial call
|
||||
config.set('foo.bar.baz', undefined)
|
||||
expect(observeHandler).toHaveBeenCalledWith(undefined)
|
||||
|
||||
it "fires the callback when the full key path goes into and out of existence", ->
|
||||
observeHandler.reset() # clear the initial call
|
||||
config.set("foo.bar", undefined)
|
||||
|
||||
@@ -139,7 +139,10 @@ _.mixin
|
||||
key = keys.shift()
|
||||
object[key] ?= {}
|
||||
object = object[key]
|
||||
object[keys.shift()] = value
|
||||
if value?
|
||||
object[keys.shift()] = value
|
||||
else
|
||||
delete object[keys.shift()]
|
||||
|
||||
compactObject: (object) ->
|
||||
newObject = {}
|
||||
|
||||
Reference in New Issue
Block a user