From 5d822b7305a7eb51cf0fa18235cf41ece605dd84 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Tue, 26 Mar 2013 12:07:05 -0600 Subject: [PATCH] Remove a package's stylesheets when it is deactivated --- spec/app/atom-spec.coffee | 10 ++++++++++ src/app/atom-package.coffee | 1 + 2 files changed, 11 insertions(+) diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index 33485475b..04a8d6d17 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -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" diff --git a/src/app/atom-package.coffee b/src/app/atom-package.coffee index e50ec880b..4820d94a0 100644 --- a/src/app/atom-package.coffee +++ b/src/app/atom-package.coffee @@ -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: ->