Add spec for existing value conforming to new schema
Esse commit está contido em:
@@ -1108,12 +1108,13 @@ describe "Config", ->
|
||||
|
||||
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)
|
||||
atom.config.setSchema('foo.bar.anInt', {type: 'integer', default: 12})
|
||||
expect(atom.config.get("foo.bar.anInt")).toBe 12
|
||||
|
||||
atom.config.set('foo.bar.aString', 'foo')
|
||||
atom.config.setSchema('foo.bar.aString', {type: 'string', default: 'bar'})
|
||||
expect(atom.config.get("foo.bar.aString")).toBe 'foo'
|
||||
|
||||
describe 'when the value has an "integer" type', ->
|
||||
beforeEach ->
|
||||
schema =
|
||||
|
||||
+4
-1
@@ -801,7 +801,10 @@ class Config
|
||||
if keyPath
|
||||
value = @get(keyPath)
|
||||
unless value is undefined
|
||||
@unset(keyPath) unless @set(keyPath, value)
|
||||
try
|
||||
@makeValueConformToSchema(keyPath, value)
|
||||
catch error
|
||||
@unset(keyPath)
|
||||
|
||||
return
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário