diff --git a/spec/app/config-panel-spec.coffee b/spec/app/config-panel-spec.coffee index dd231eb2f..a1f9dabed 100644 --- a/spec/app/config-panel-spec.coffee +++ b/spec/app/config-panel-spec.coffee @@ -73,8 +73,10 @@ describe "ConfigPanel", -> expect(config.get('foo.float')).toBe 3.3 expect(config.get('foo.string')).toBe 'All limitations are self imposed.' - panel.intEditor.setText('') - panel.floatEditor.setText('ha ha') + panel.intEditor.setText('not an int') + panel.floatEditor.setText('not a float') + panel.stringEditor.setText('') window.advanceClock(10000) # wait for contents-modified to be triggered expect(config.get('foo.int')).toBe 0 expect(config.get('foo.float')).toBe 0 + expect(config.get('foo.string')).toBe undefined diff --git a/src/app/config-panel.coffee b/src/app/config-panel.coffee index 31b76b8b1..d884cea7d 100644 --- a/src/app/config-panel.coffee +++ b/src/app/config-panel.coffee @@ -43,4 +43,5 @@ class ConfigPanel extends View value = editor.getText() if type == 'int' then value = parseInt(value) or 0 if type == 'float' then value = parseFloat(value) or 0 + if value == "" then value = undefined config.set name, value