mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
ThemeManager emits a reload event when reloaded
This commit is contained in:
@@ -7,10 +7,13 @@ describe "ThemeManager", ->
|
||||
describe "when the core.themes config value changes", ->
|
||||
it "add/removes stylesheets to reflect the new config value", ->
|
||||
themeManager = new ThemeManager()
|
||||
themeManager.on 'reload', reloadHandler = jasmine.createSpy()
|
||||
spyOn(themeManager, 'getUserStylesheetPath').andCallFake -> null
|
||||
themeManager.load()
|
||||
|
||||
config.set('core.themes', [])
|
||||
expect($('style.userTheme').length).toBe 0
|
||||
expect(reloadHandler).toHaveBeenCalled()
|
||||
|
||||
config.set('core.themes', ['atom-dark-syntax'])
|
||||
expect($('style.userTheme').length).toBe 1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
path = require 'path'
|
||||
EventEmitter = require 'event-emitter'
|
||||
|
||||
_ = require 'underscore'
|
||||
|
||||
@@ -7,6 +8,8 @@ Theme = require 'theme'
|
||||
|
||||
module.exports =
|
||||
class ThemeManager
|
||||
_.extend @prototype, EventEmitter
|
||||
|
||||
constructor: ->
|
||||
@loadedThemes = []
|
||||
|
||||
@@ -27,6 +30,8 @@ class ThemeManager
|
||||
@loadTheme(themeName) for themeName in themeNames
|
||||
@loadUserStylesheet()
|
||||
|
||||
@trigger('reload')
|
||||
|
||||
loadTheme: (name) ->
|
||||
try
|
||||
@loadedThemes.push(new Theme(name))
|
||||
|
||||
Reference in New Issue
Block a user