mirror of
https://github.com/atom/atom.git
synced 2026-02-06 20:55:33 -05:00
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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user