Unset values that do not conform to schema
Esse commit está contido em:
@@ -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
@@ -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
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário