mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Empty editors trigger config to delete the associated config key
This commit is contained in:
committed by
Corey Johnson & Kevin Sawicki
parent
b878be27a0
commit
9f85ba4f7d
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user