diff --git a/spec/app/config-spec.coffee b/spec/app/config-spec.coffee index 2c10f345d..ab35b7b02 100644 --- a/spec/app/config-spec.coffee +++ b/spec/app/config-spec.coffee @@ -25,13 +25,17 @@ describe "Config", -> config.get("foo.bar.baz").push("b") config.update() expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz") + observeHandler.reset() + + config.update() + expect(observeHandler).not.toHaveBeenCalled() describe ".observe(keyPath)", -> observeHandler = null beforeEach -> observeHandler = jasmine.createSpy("observeHandler") - config.foo = { bar: { baz: "value 1" } } + config.set("foo.bar.baz", "value 1") config.observe "foo.bar.baz", observeHandler it "fires the given callback with the current value at the keypath", -> diff --git a/src/app/config.coffee b/src/app/config.coffee index 8ea3abf4f..97ca52418 100644 --- a/src/app/config.coffee +++ b/src/app/config.coffee @@ -83,7 +83,7 @@ class Config previousValue = _.clone(value) updateCallback = => value = @get(keyPath) - unless value == previousValue + unless _.isEqual(value, previousValue) previousValue = _.clone(value) callback(value)