Unset values that do not conform to schema

Esse commit está contido em:
Kevin Sawicki
2015-01-22 15:48:12 -08:00
commit 0ecb46504c
2 arquivos alterados com 10 adições e 1 exclusões
+8
Ver Arquivo
@@ -1106,6 +1106,14 @@ describe "Config", ->
expect(atom.config.get('foo.bar.str', scope: ['.source.js'])).toBe 'omg'
expect(atom.config.get('foo.bar.str', scope: ['.source.coffee'])).toBe 'ok'
it "validates any values set before the schema was set", ->
atom.config.set('foo.bar.anInt', 'integer')
schema =
type: 'integer'
default: 12
atom.config.setSchema('foo.bar.anInt', schema)
expect(atom.config.get("foo.bar.anInt")).toBe 12
describe 'when the value has an "integer" type', ->
beforeEach ->
schema =
+2 -1
Ver Arquivo
@@ -800,7 +800,8 @@ class Config
if keyPath
value = @get(keyPath)
@set(keyPath, value) unless value is undefined
unless value is undefined
@unset(keyPath) unless @set(keyPath, value)
return