Load the default themes in safe mode

This commit is contained in:
Maximilian Schüßler 2014-08-05 13:32:16 +02:00
parent 87edff1e42
commit b463d9d876
3 changed files with 17 additions and 2 deletions

View File

@ -310,3 +310,17 @@ describe "ThemeManager", ->
runs ->
expect(console.warn.callCount).toBe 1
expect(console.warn.argsForCall[0][0].length).toBeGreaterThan 0
describe "when in safemode", ->
beforeEach ->
themeManager = new ThemeManager({packageManager: atom.packages, resourcePath, configDirPath, safeMode: true})
it "loads the defaults themes", ->
waitsForPromise ->
themeManager.activateThemes()
runs ->
activeThemeNames = themeManager.getActiveNames()
expect(activeThemeNames.length).toBe(2)
expect(activeThemeNames).toContain('atom-dark-ui')
expect(activeThemeNames).toContain('atom-dark-syntax')

View File

@ -156,7 +156,7 @@ class Atom extends Model
@keymaps = new KeymapManager({configDirPath, resourcePath})
@keymap = @keymaps # Deprecated
@packages = new PackageManager({devMode, configDirPath, resourcePath, safeMode})
@themes = new ThemeManager({packageManager: @packages, configDirPath, resourcePath})
@themes = new ThemeManager({packageManager: @packages, configDirPath, resourcePath, safeMode})
@contextMenu = new ContextMenuManager(devMode)
@menu = new MenuManager({resourcePath})
@clipboard = new Clipboard()

View File

@ -16,7 +16,7 @@ module.exports =
class ThemeManager
Emitter.includeInto(this)
constructor: ({@packageManager, @resourcePath, @configDirPath}) ->
constructor: ({@packageManager, @resourcePath, @configDirPath, @safeMode}) ->
@lessCache = null
@packageManager.registerPackageActivator(this, ['theme'])
@ -46,6 +46,7 @@ class ThemeManager
#
# Returns an array of theme names in the order that they should be activated.
getEnabledThemeNames: ->
return ['atom-dark-ui', 'atom-dark-syntax'] if @safeMode
themeNames = atom.config.get('core.themes') ? []
themeNames = [themeNames] unless _.isArray(themeNames)
themeNames = themeNames.filter (themeName) ->