Remove a package's stylesheets when it is deactivated

This commit is contained in:
Corey Johnson & Nathan Sobo 2013-03-26 12:07:05 -06:00 committed by Nathan Sobo
parent 1e51750b6c
commit 5d822b7305
2 changed files with 11 additions and 0 deletions

View File

@ -156,6 +156,16 @@ describe "the `atom` global", ->
expect(keymap.bindingsForElement($$ -> @div class: 'test-1')['ctrl-z']).toBeUndefined()
expect(keymap.bindingsForElement($$ -> @div class: 'test-2')['ctrl-z']).toBeUndefined()
it "removes the package's stylesheets", ->
atom.activatePackage('package-with-stylesheets')
atom.deactivatePackage('package-with-stylesheets')
one = fs.resolveOnLoadPath("package-with-stylesheets/stylesheets/1.css")
two = fs.resolveOnLoadPath("package-with-stylesheets/stylesheets/2.less")
three = fs.resolveOnLoadPath("package-with-stylesheets/stylesheets/3.css")
expect(stylesheetElementForId(one)).not.toExist()
expect(stylesheetElementForId(two)).not.toExist()
expect(stylesheetElementForId(three)).not.toExist()
describe "texmate packages", ->
it "removes the package's grammars", ->
expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar"

View File

@ -95,6 +95,7 @@ class AtomPackage extends Package
deactivate: ->
syntax.removeGrammar(grammar) for grammar in @grammars
keymap.remove(path) for [path] in @keymaps
removeStylesheet(path) for [path] in @stylesheets
@mainModule?.deactivate?()
requireMainModule: ->