Parse object settings into colors manually

Esse commit está contido em:
Kevin Sawicki
2015-01-26 14:12:03 -08:00
commit 9a5be7e70c
3 arquivos alterados com 4 adições e 19 exclusões
-9
Ver Arquivo
@@ -1106,15 +1106,6 @@ 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')
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 =
-10
Ver Arquivo
@@ -798,16 +798,6 @@ class Config
@setDefaults(keyPath, @extractDefaultsFromSchema(schema))
@setScopedDefaultsFromSchema(keyPath, schema)
if keyPath
value = @get(keyPath)
unless value is undefined
try
@makeValueConformToSchema(keyPath, value)
catch error
@unset(keyPath)
return
load: ->
@initializeConfigDirectory()
@loadUserConfig()
+4
Ver Arquivo
@@ -9,6 +9,7 @@ EmitterMixin = require('emissary').Emitter
Q = require 'q'
{deprecate} = require 'grim'
Color = require './color'
ModuleCache = require './module-cache'
ScopedProperties = require './scoped-properties'
@@ -265,7 +266,10 @@ class Package
variables = {}
for key, value of atom.config.get(@name)
if typeof value is 'object' and not (value instanceof Color)
value = Color.parse(value)
value = value?.toRGBAString?() ? value
continue if value?.length is 0
variables[key] = value if typeof value in ['number', 'string']
variables