Update enabled themes list when config key is updated

This commit is contained in:
Nathan Sobo
2013-04-17 20:47:26 -06:00
committed by Corey Johnson & Kevin Sawicki
parent b110f430ee
commit ad0bcc3851
2 changed files with 9 additions and 2 deletions

View File

@@ -36,3 +36,8 @@ describe "ThemeConfigPanel", ->
panel.enabledThemes.sortable('option', 'receive')(null, helper: dragHelper[0])
panel.enabledThemes.sortable('option', 'update')()
expect(config.get('core.themes')).toEqual ['atom-dark-ui', 'atom-dark-syntax']
describe "when the 'core.config' key is updated", ->
it "refreshes the enabled themes list", ->
config.set('core.themes', ['atom-light-ui', 'atom-light-syntax'])
expect(panel.getEnabledThemeNames()).toEqual ['atom-light-ui', 'atom-light-syntax']

View File

@@ -29,8 +29,10 @@ class ThemeConfigPanel extends ConfigPanel
for name in atom.getAvailableThemeNames()
@availableThemes.append(@buildThemeLi(name, draggable: true))
for name in config.get("core.themes") ? []
@enabledThemes.append(@buildThemeLi(name))
@observeConfig "core.themes", (enabledThemes) =>
@enabledThemes.empty()
for name in enabledThemes ? []
@enabledThemes.append(@buildThemeLi(name))
@enabledThemes.sortable
receive: (e, ui) => @enabledThemeReceived($(ui.helper))