Files
atom/spec/app/theme-manager-spec.coffee
Kevin Sawicki 7e04d85e1e Log a warning when a theme fails to load
Previously Atom would fail to launch if a theme referenced in
the config was not found.
2013-08-09 11:25:07 -07:00

33 lines
1.3 KiB
CoffeeScript

$ = require 'jquery'
Theme = require 'theme'
ThemeManager = require 'theme-manager'
describe "ThemeManager", ->
describe "when the core.themes config value changes", ->
it "add/removes stylesheets to reflect the new config value", ->
themeManager = new ThemeManager()
spyOn(themeManager, 'getUserStylesheetPath').andCallFake -> null
themeManager.load()
config.set('core.themes', [])
expect($('style.userTheme').length).toBe 0
config.set('core.themes', ['atom-dark-syntax'])
expect($('style.userTheme').length).toBe 1
expect($('style.userTheme:eq(0)').attr('id')).toMatch /atom-dark-syntax.less$/
config.set('core.themes', ['atom-light-syntax', 'atom-dark-syntax'])
expect($('style.userTheme').length).toBe 2
expect($('style.userTheme:eq(0)').attr('id')).toMatch /atom-light-syntax.less$/
expect($('style.userTheme:eq(1)').attr('id')).toMatch /atom-dark-syntax.less$/
config.set('core.themes', [])
expect($('style.userTheme').length).toBe 0
describe "when a theme fails to load", ->
it "logs a warning", ->
themeManager = new ThemeManager()
spyOn(console, 'warn')
themeManager.loadTheme('a-theme-that-will-not-be-found')
expect(console.warn).toHaveBeenCalled()