mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Remove unnecessary lines
This commit is contained in:
@@ -4,7 +4,7 @@ path = require 'path'
|
||||
ThemeManager = require '../src/theme-manager'
|
||||
AtomPackage = require '../src/atom-package'
|
||||
|
||||
describe "ThemeManager", ->
|
||||
fdescribe "ThemeManager", ->
|
||||
themeManager = null
|
||||
|
||||
beforeEach ->
|
||||
@@ -74,7 +74,7 @@ describe "ThemeManager", ->
|
||||
describe "when a theme fails to load", ->
|
||||
it "logs a warning", ->
|
||||
spyOn(console, 'warn')
|
||||
expect(-> themeManager.activateTheme('a-theme-that-will-not-be-found')).toThrow()
|
||||
expect(-> atom.packages.activatePackage('a-theme-that-will-not-be-found')).toThrow()
|
||||
|
||||
describe "requireStylesheet(path)", ->
|
||||
it "synchronously loads css at the given path and installs a style tag for it in the head", ->
|
||||
|
||||
@@ -90,9 +90,6 @@ class PackageManager
|
||||
if @isPackageDisabled(name)
|
||||
return console.warn("Tried to load disabled package '#{name}'")
|
||||
|
||||
pack = @getLoadedPackage(name)
|
||||
return pack if pack
|
||||
|
||||
if packagePath = @resolvePackagePath(name)
|
||||
return pack if pack = @getLoadedPackage(name)
|
||||
|
||||
|
||||
@@ -42,32 +42,24 @@ class ThemeManager
|
||||
activateThemes: ->
|
||||
# atom.config.observe runs the callback once, then on subsequent changes.
|
||||
atom.config.observe 'core.themes', (themeNames) =>
|
||||
@deactivateThemes()
|
||||
@packageManager.deactivatePackages()
|
||||
themeNames = [themeNames] unless _.isArray(themeNames)
|
||||
|
||||
# Reverse so the first (top) theme is loaded after the others. We want
|
||||
# the first/top theme to override later themes in the stack.
|
||||
themeNames = _.clone(themeNames).reverse()
|
||||
|
||||
@activateTheme(themeName) for themeName in themeNames
|
||||
@packageManager.activatePackage(themeName) for themeName in themeNames
|
||||
@loadUserStylesheet()
|
||||
@reloadBaseStylesheets()
|
||||
@emit('reloaded')
|
||||
|
||||
# Internal-only:
|
||||
activateTheme: (themeName) ->
|
||||
@packageManager.activatePackage(themeName)
|
||||
|
||||
# Internal-only:
|
||||
deactivateThemes: ->
|
||||
@removeStylesheet(@userStylesheetPath) if @userStylesheetPath?
|
||||
@deactivateTheme(pack.name) for pack in @getActiveThemes()
|
||||
@packageManager.deactivatePackage(pack.name) for pack in @getActiveThemes()
|
||||
null
|
||||
|
||||
# Internal-only:
|
||||
deactivateTheme: (themeName) ->
|
||||
@packageManager.deactivatePackage(themeName)
|
||||
|
||||
# Public:
|
||||
getImportPaths: ->
|
||||
activeThemes = @getActiveThemes()
|
||||
|
||||
Reference in New Issue
Block a user