Support descriptions for enum values in config.

The enum property may now specify options as a list of {value:,
description:} objects.
This commit is contained in:
George Ogata
2015-07-15 01:29:22 -04:00
parent 10b8de6fc4
commit 790ea8e6f2
2 changed files with 44 additions and 3 deletions

View File

@@ -1572,6 +1572,14 @@ describe "Config", ->
items:
type: 'string'
enum: ['one', 'two', 'three']
str_options:
type: 'string'
default: 'one'
enum: [
value: 'one', description: 'One'
'two',
value: 'three', description: 'Three'
]
atom.config.setSchema('foo.bar', schema)
@@ -1595,3 +1603,13 @@ describe "Config", ->
expect(atom.config.set('foo.bar.arr', ['two', 'three'])).toBe true
expect(atom.config.get('foo.bar.arr')).toEqual ['two', 'three']
it 'will honor the enum when specified as an array', ->
expect(atom.config.set('foo.bar.str_options', 'one')).toBe true
expect(atom.config.get('foo.bar.str_options')).toEqual 'one'
expect(atom.config.set('foo.bar.str_options', 'two')).toBe true
expect(atom.config.get('foo.bar.str_options')).toEqual 'two'
expect(atom.config.set('foo.bar.str_options', 'One')).toBe false
expect(atom.config.get('foo.bar.str_options')).toEqual 'two'