2013-09-20 00:51:53 +04:00
|
|
|
|
{$, $$, fs, RootView} = require 'atom'
|
2013-04-11 03:02:13 +04:00
|
|
|
|
Exec = require('child_process').exec
|
2013-06-21 00:42:16 +04:00
|
|
|
|
path = require 'path'
|
2012-12-19 06:47:20 +04:00
|
|
|
|
|
2013-02-08 02:37:48 +04:00
|
|
|
|
describe "the `atom` global", ->
|
2013-02-08 00:17:34 +04:00
|
|
|
|
beforeEach ->
|
2013-02-20 04:18:25 +04:00
|
|
|
|
window.rootView = new RootView
|
2013-02-08 23:51:51 +04:00
|
|
|
|
|
2013-03-25 20:57:58 +04:00
|
|
|
|
describe "package lifecycle methods", ->
|
2013-05-22 01:15:26 +04:00
|
|
|
|
describe ".loadPackage(name)", ->
|
2013-03-27 01:46:19 +04:00
|
|
|
|
describe "when the package has deferred deserializers", ->
|
|
|
|
|
it "requires the package's main module if one of its deferred deserializers is referenced", ->
|
|
|
|
|
pack = atom.loadPackage('package-with-activation-events')
|
2013-10-03 06:10:53 +04:00
|
|
|
|
spyOn(pack, 'activateStylesheets').andCallThrough()
|
2013-03-27 01:46:19 +04:00
|
|
|
|
expect(pack.mainModule).toBeNull()
|
|
|
|
|
object = deserialize({deserializer: 'Foo', data: 5})
|
|
|
|
|
expect(pack.mainModule).toBeDefined()
|
|
|
|
|
expect(object.constructor.name).toBe 'Foo'
|
|
|
|
|
expect(object.data).toBe 5
|
2013-10-03 06:10:53 +04:00
|
|
|
|
expect(pack.activateStylesheets).toHaveBeenCalled()
|
2013-03-27 01:46:19 +04:00
|
|
|
|
|
2013-05-22 01:15:26 +04:00
|
|
|
|
describe ".unloadPackage(name)", ->
|
|
|
|
|
describe "when the package is active", ->
|
|
|
|
|
it "throws an error", ->
|
|
|
|
|
pack = atom.activatePackage('package-with-main')
|
|
|
|
|
expect(atom.isPackageLoaded(pack.name)).toBeTruthy()
|
|
|
|
|
expect(atom.isPackageActive(pack.name)).toBeTruthy()
|
|
|
|
|
expect( -> atom.unloadPackage(pack.name)).toThrow()
|
|
|
|
|
expect(atom.isPackageLoaded(pack.name)).toBeTruthy()
|
|
|
|
|
expect(atom.isPackageActive(pack.name)).toBeTruthy()
|
|
|
|
|
|
|
|
|
|
describe "when the package is not loaded", ->
|
|
|
|
|
it "throws an error", ->
|
|
|
|
|
expect(atom.isPackageLoaded('unloaded')).toBeFalsy()
|
|
|
|
|
expect( -> atom.unloadPackage('unloaded')).toThrow()
|
|
|
|
|
expect(atom.isPackageLoaded('unloaded')).toBeFalsy()
|
|
|
|
|
|
|
|
|
|
describe "when the package is loaded", ->
|
|
|
|
|
it "no longers reports it as being loaded", ->
|
|
|
|
|
pack = atom.loadPackage('package-with-main')
|
|
|
|
|
expect(atom.isPackageLoaded(pack.name)).toBeTruthy()
|
|
|
|
|
atom.unloadPackage(pack.name)
|
|
|
|
|
expect(atom.isPackageLoaded(pack.name)).toBeFalsy()
|
|
|
|
|
|
2013-03-25 20:57:58 +04:00
|
|
|
|
describe ".activatePackage(id)", ->
|
2013-03-26 03:55:21 +04:00
|
|
|
|
describe "atom packages", ->
|
2013-03-26 04:57:30 +04:00
|
|
|
|
describe "when the package has a main module", ->
|
|
|
|
|
describe "when the metadata specifies a main module path˜", ->
|
|
|
|
|
it "requires the module at the specified path", ->
|
2013-09-18 02:58:08 +04:00
|
|
|
|
mainModule = require('./fixtures/packages/package-with-main/main-module')
|
2013-03-26 04:57:30 +04:00
|
|
|
|
spyOn(mainModule, 'activate')
|
|
|
|
|
pack = atom.activatePackage('package-with-main')
|
|
|
|
|
expect(mainModule.activate).toHaveBeenCalled()
|
|
|
|
|
expect(pack.mainModule).toBe mainModule
|
|
|
|
|
|
|
|
|
|
describe "when the metadata does not specify a main module", ->
|
|
|
|
|
it "requires index.coffee", ->
|
2013-09-18 02:58:08 +04:00
|
|
|
|
indexModule = require('./fixtures/packages/package-with-index/index')
|
2013-03-26 04:57:30 +04:00
|
|
|
|
spyOn(indexModule, 'activate')
|
|
|
|
|
pack = atom.activatePackage('package-with-index')
|
|
|
|
|
expect(indexModule.activate).toHaveBeenCalled()
|
|
|
|
|
expect(pack.mainModule).toBe indexModule
|
|
|
|
|
|
2013-03-26 22:12:47 +04:00
|
|
|
|
it "assigns config defaults from the module", ->
|
|
|
|
|
expect(config.get('package-with-config-defaults.numbers.one')).toBeUndefined()
|
|
|
|
|
atom.activatePackage('package-with-config-defaults')
|
|
|
|
|
expect(config.get('package-with-config-defaults.numbers.one')).toBe 1
|
|
|
|
|
expect(config.get('package-with-config-defaults.numbers.two')).toBe 2
|
|
|
|
|
|
2013-03-27 01:42:58 +04:00
|
|
|
|
describe "when the package metadata includes activation events", ->
|
|
|
|
|
[mainModule, pack] = []
|
|
|
|
|
|
|
|
|
|
beforeEach ->
|
2013-09-18 02:58:08 +04:00
|
|
|
|
mainModule = require './fixtures/packages/package-with-activation-events/index'
|
2013-03-27 01:42:58 +04:00
|
|
|
|
spyOn(mainModule, 'activate').andCallThrough()
|
2013-09-19 03:01:15 +04:00
|
|
|
|
AtomPackage = require '../src/atom-package'
|
2013-03-27 03:20:16 +04:00
|
|
|
|
spyOn(AtomPackage.prototype, 'requireMainModule').andCallThrough()
|
2013-03-27 01:42:58 +04:00
|
|
|
|
pack = atom.activatePackage('package-with-activation-events')
|
|
|
|
|
|
|
|
|
|
it "defers requiring/activating the main module until an activation event bubbles to the root view", ->
|
2013-03-27 03:20:16 +04:00
|
|
|
|
expect(pack.requireMainModule).not.toHaveBeenCalled()
|
2013-03-27 01:42:58 +04:00
|
|
|
|
expect(mainModule.activate).not.toHaveBeenCalled()
|
|
|
|
|
rootView.trigger 'activation-event'
|
|
|
|
|
expect(mainModule.activate).toHaveBeenCalled()
|
|
|
|
|
|
|
|
|
|
it "triggers the activation event on all handlers registered during activation", ->
|
|
|
|
|
rootView.open()
|
|
|
|
|
editor = rootView.getActiveView()
|
|
|
|
|
eventHandler = jasmine.createSpy("activation-event")
|
|
|
|
|
editor.command 'activation-event', eventHandler
|
|
|
|
|
editor.trigger 'activation-event'
|
|
|
|
|
expect(mainModule.activate.callCount).toBe 1
|
|
|
|
|
expect(mainModule.activationEventCallCount).toBe 1
|
|
|
|
|
expect(eventHandler.callCount).toBe 1
|
|
|
|
|
editor.trigger 'activation-event'
|
|
|
|
|
expect(mainModule.activationEventCallCount).toBe 2
|
|
|
|
|
expect(eventHandler.callCount).toBe 2
|
|
|
|
|
expect(mainModule.activate.callCount).toBe 1
|
|
|
|
|
|
2013-03-26 04:57:30 +04:00
|
|
|
|
describe "when the package has no main module", ->
|
|
|
|
|
it "does not throw an exception", ->
|
|
|
|
|
spyOn(console, "error")
|
|
|
|
|
spyOn(console, "warn").andCallThrough()
|
|
|
|
|
expect(-> atom.activatePackage('package-without-module')).not.toThrow()
|
|
|
|
|
expect(console.error).not.toHaveBeenCalled()
|
|
|
|
|
expect(console.warn).not.toHaveBeenCalled()
|
2013-01-04 02:10:11 +04:00
|
|
|
|
|
2013-03-26 20:50:40 +04:00
|
|
|
|
it "passes the activate method the package's previously serialized state if it exists", ->
|
2013-03-26 04:57:30 +04:00
|
|
|
|
pack = atom.activatePackage("package-with-serialization")
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(pack.mainModule.someNumber).not.toBe 77
|
|
|
|
|
pack.mainModule.someNumber = 77
|
2013-03-26 04:57:30 +04:00
|
|
|
|
atom.deactivatePackage("package-with-serialization")
|
2013-03-26 03:55:21 +04:00
|
|
|
|
spyOn(pack.mainModule, 'activate').andCallThrough()
|
2013-03-26 04:57:30 +04:00
|
|
|
|
atom.activatePackage("package-with-serialization")
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(pack.mainModule.activate).toHaveBeenCalledWith({someNumber: 77})
|
2013-01-04 02:10:11 +04:00
|
|
|
|
|
2013-03-26 20:50:40 +04:00
|
|
|
|
it "logs warning instead of throwing an exception if the package fails to load", ->
|
2013-03-26 03:55:21 +04:00
|
|
|
|
config.set("core.disabledPackages", [])
|
|
|
|
|
spyOn(console, "warn")
|
|
|
|
|
expect(-> atom.activatePackage("package-that-throws-an-exception")).not.toThrow()
|
|
|
|
|
expect(console.warn).toHaveBeenCalled()
|
2013-01-04 02:10:11 +04:00
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
describe "keymap loading", ->
|
2013-03-26 04:57:30 +04:00
|
|
|
|
describe "when the metadata does not contain a 'keymaps' manifest", ->
|
2013-03-26 03:55:21 +04:00
|
|
|
|
it "loads all the .cson/.json files in the keymaps directory", ->
|
|
|
|
|
element1 = $$ -> @div class: 'test-1'
|
|
|
|
|
element2 = $$ -> @div class: 'test-2'
|
|
|
|
|
element3 = $$ -> @div class: 'test-3'
|
2013-01-04 02:10:11 +04:00
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(keymap.bindingsForElement(element1)['ctrl-z']).toBeUndefined()
|
|
|
|
|
expect(keymap.bindingsForElement(element2)['ctrl-z']).toBeUndefined()
|
|
|
|
|
expect(keymap.bindingsForElement(element3)['ctrl-z']).toBeUndefined()
|
2013-01-04 02:10:11 +04:00
|
|
|
|
|
2013-03-26 04:57:30 +04:00
|
|
|
|
atom.activatePackage("package-with-keymaps")
|
2013-01-28 10:38:11 +04:00
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(keymap.bindingsForElement(element1)['ctrl-z']).toBe "test-1"
|
|
|
|
|
expect(keymap.bindingsForElement(element2)['ctrl-z']).toBe "test-2"
|
|
|
|
|
expect(keymap.bindingsForElement(element3)['ctrl-z']).toBeUndefined()
|
2013-02-09 05:19:45 +04:00
|
|
|
|
|
2013-03-26 04:57:30 +04:00
|
|
|
|
describe "when the metadata contains a 'keymaps' manifest", ->
|
2013-03-26 03:55:21 +04:00
|
|
|
|
it "loads only the keymaps specified by the manifest, in the specified order", ->
|
|
|
|
|
element1 = $$ -> @div class: 'test-1'
|
|
|
|
|
element3 = $$ -> @div class: 'test-3'
|
2013-03-23 06:46:32 +04:00
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(keymap.bindingsForElement(element1)['ctrl-z']).toBeUndefined()
|
2013-03-23 06:46:32 +04:00
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
atom.activatePackage("package-with-keymaps-manifest")
|
2013-02-09 05:19:45 +04:00
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(keymap.bindingsForElement(element1)['ctrl-z']).toBe 'keymap-1'
|
|
|
|
|
expect(keymap.bindingsForElement(element1)['ctrl-n']).toBe 'keymap-2'
|
|
|
|
|
expect(keymap.bindingsForElement(element3)['ctrl-y']).toBeUndefined()
|
2013-02-09 05:19:45 +04:00
|
|
|
|
|
2013-09-20 01:21:31 +04:00
|
|
|
|
describe "menu loading", ->
|
2013-09-20 01:55:17 +04:00
|
|
|
|
beforeEach -> atom.contextMenu.definitions = []
|
|
|
|
|
|
2013-09-20 01:21:31 +04:00
|
|
|
|
describe "when the metadata does not contain a 'menus' manifest", ->
|
2013-09-20 01:55:17 +04:00
|
|
|
|
it "loads all the .cson/.json files in the menus directory", ->
|
2013-09-20 01:21:31 +04:00
|
|
|
|
element = ($$ -> @div class: 'test-1')[0]
|
|
|
|
|
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)).toEqual []
|
|
|
|
|
|
|
|
|
|
atom.activatePackage("package-with-menus")
|
|
|
|
|
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)[0].label).toBe "Menu item 1"
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)[1].label).toBe "Menu item 2"
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)[2].label).toBe "Menu item 3"
|
|
|
|
|
|
2013-09-20 01:55:17 +04:00
|
|
|
|
describe "when the metadata contains a 'menus' manifest", ->
|
2013-09-20 01:21:31 +04:00
|
|
|
|
it "loads only the menus specified by the manifest, in the specified order", ->
|
|
|
|
|
element = ($$ -> @div class: 'test-1')[0]
|
|
|
|
|
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)).toEqual []
|
|
|
|
|
|
|
|
|
|
atom.activatePackage("package-with-menus-manifest")
|
|
|
|
|
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)[0].label).toBe "Menu item 2"
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)[1].label).toBe "Menu item 1"
|
|
|
|
|
expect(atom.contextMenu.definitionsForElement(element)[2]).toBeUndefined()
|
|
|
|
|
|
|
|
|
|
|
2013-03-26 04:57:30 +04:00
|
|
|
|
describe "stylesheet loading", ->
|
|
|
|
|
describe "when the metadata contains a 'stylesheets' manifest", ->
|
2013-03-26 20:50:40 +04:00
|
|
|
|
it "loads stylesheets from the stylesheets directory as specified by the manifest", ->
|
2013-09-18 02:58:08 +04:00
|
|
|
|
one = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css")
|
|
|
|
|
two = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less")
|
|
|
|
|
three = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css")
|
2013-09-25 19:39:16 +04:00
|
|
|
|
expect(atom.themes.stylesheetElementForId(one)).not.toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(two)).not.toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(three)).not.toExist()
|
2013-03-26 20:50:40 +04:00
|
|
|
|
|
|
|
|
|
atom.activatePackage("package-with-stylesheets-manifest")
|
|
|
|
|
|
2013-09-25 19:39:16 +04:00
|
|
|
|
expect(atom.themes.stylesheetElementForId(one)).toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(two)).toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(three)).not.toExist()
|
2013-03-26 20:50:40 +04:00
|
|
|
|
expect($('#jasmine-content').css('font-size')).toBe '1px'
|
2013-03-26 04:57:30 +04:00
|
|
|
|
|
2013-03-26 22:12:53 +04:00
|
|
|
|
describe "when the metadata does not contain a 'stylesheets' manifest", ->
|
2013-03-26 04:57:30 +04:00
|
|
|
|
it "loads all stylesheets from the stylesheets directory", ->
|
2013-09-18 02:58:08 +04:00
|
|
|
|
one = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/1.css")
|
|
|
|
|
two = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/2.less")
|
|
|
|
|
three = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/3.css")
|
2013-09-25 19:39:16 +04:00
|
|
|
|
expect(atom.themes.stylesheetElementForId(one)).not.toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(two)).not.toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(three)).not.toExist()
|
2013-03-26 04:57:30 +04:00
|
|
|
|
|
|
|
|
|
atom.activatePackage("package-with-stylesheets")
|
2013-09-25 19:39:16 +04:00
|
|
|
|
expect(atom.themes.stylesheetElementForId(one)).toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(two)).toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(three)).toExist()
|
2013-03-26 04:57:30 +04:00
|
|
|
|
expect($('#jasmine-content').css('font-size')).toBe '3px'
|
2013-03-26 03:55:21 +04:00
|
|
|
|
|
2013-03-26 21:21:44 +04:00
|
|
|
|
describe "grammar loading", ->
|
|
|
|
|
it "loads the package's grammars", ->
|
|
|
|
|
atom.activatePackage('package-with-grammars')
|
|
|
|
|
expect(syntax.selectGrammar('a.alot').name).toBe 'Alot'
|
|
|
|
|
expect(syntax.selectGrammar('a.alittle').name).toBe 'Alittle'
|
|
|
|
|
|
2013-03-26 22:17:05 +04:00
|
|
|
|
describe "scoped-property loading", ->
|
|
|
|
|
it "loads the scoped properties", ->
|
|
|
|
|
atom.activatePackage("package-with-scoped-properties")
|
|
|
|
|
expect(syntax.getProperty ['.source.omg'], 'editor.increaseIndentPattern').toBe '^a'
|
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
describe "textmate packages", ->
|
|
|
|
|
it "loads the package's grammars", ->
|
|
|
|
|
expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar"
|
2013-05-29 21:24:34 +04:00
|
|
|
|
atom.activatePackage('ruby-tmbundle', sync: true)
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(syntax.selectGrammar("file.rb").name).toBe "Ruby"
|
2013-03-25 20:57:58 +04:00
|
|
|
|
|
2013-03-27 03:27:21 +04:00
|
|
|
|
it "translates the package's scoped properties to Atom terms", ->
|
|
|
|
|
expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined()
|
2013-05-29 21:24:34 +04:00
|
|
|
|
atom.activatePackage('ruby-tmbundle', sync: true)
|
2013-03-27 03:27:21 +04:00
|
|
|
|
expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBe '# '
|
|
|
|
|
|
2013-06-12 00:52:40 +04:00
|
|
|
|
describe "when the package has no grammars but does have preferences", ->
|
|
|
|
|
it "loads the package's preferences as scoped properties", ->
|
|
|
|
|
jasmine.unspy(window, 'setTimeout')
|
|
|
|
|
spyOn(syntax, 'addProperties').andCallThrough()
|
|
|
|
|
|
|
|
|
|
atom.activatePackage('package-with-preferences-tmbundle')
|
|
|
|
|
|
|
|
|
|
waitsFor ->
|
|
|
|
|
syntax.addProperties.callCount > 0
|
|
|
|
|
runs ->
|
|
|
|
|
expect(syntax.getProperty(['.source.pref'], 'editor.increaseIndentPattern')).toBe '^abc$'
|
|
|
|
|
|
2013-03-25 20:57:58 +04:00
|
|
|
|
describe ".deactivatePackage(id)", ->
|
2013-03-26 03:55:21 +04:00
|
|
|
|
describe "atom packages", ->
|
2013-08-30 01:44:00 +04:00
|
|
|
|
it "calls `deactivate` on the package's main module if activate was successful", ->
|
2013-03-26 21:00:29 +04:00
|
|
|
|
pack = atom.activatePackage("package-with-deactivate")
|
|
|
|
|
expect(atom.isPackageActive("package-with-deactivate")).toBeTruthy()
|
2013-03-26 03:55:21 +04:00
|
|
|
|
spyOn(pack.mainModule, 'deactivate').andCallThrough()
|
|
|
|
|
|
2013-03-26 21:00:29 +04:00
|
|
|
|
atom.deactivatePackage("package-with-deactivate")
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(pack.mainModule.deactivate).toHaveBeenCalled()
|
2013-03-26 21:00:29 +04:00
|
|
|
|
expect(atom.isPackageActive("package-with-module")).toBeFalsy()
|
2013-03-26 03:55:21 +04:00
|
|
|
|
|
2013-08-30 01:44:00 +04:00
|
|
|
|
spyOn(console, 'warn')
|
|
|
|
|
badPack = atom.activatePackage("package-that-throws-on-activate")
|
|
|
|
|
expect(atom.isPackageActive("package-that-throws-on-activate")).toBeTruthy()
|
|
|
|
|
spyOn(badPack.mainModule, 'deactivate').andCallThrough()
|
|
|
|
|
|
|
|
|
|
atom.deactivatePackage("package-that-throws-on-activate")
|
|
|
|
|
expect(badPack.mainModule.deactivate).not.toHaveBeenCalled()
|
|
|
|
|
expect(atom.isPackageActive("package-that-throws-on-activate")).toBeFalsy()
|
|
|
|
|
|
|
|
|
|
it "does not serialize packages that have not been activated called on their main module", ->
|
|
|
|
|
spyOn(console, 'warn')
|
|
|
|
|
badPack = atom.activatePackage("package-that-throws-on-activate")
|
|
|
|
|
spyOn(badPack.mainModule, 'serialize').andCallThrough()
|
|
|
|
|
|
|
|
|
|
atom.deactivatePackage("package-that-throws-on-activate")
|
|
|
|
|
expect(badPack.mainModule.serialize).not.toHaveBeenCalled()
|
|
|
|
|
|
2013-03-26 03:55:21 +04:00
|
|
|
|
it "absorbs exceptions that are thrown by the package module's serialize methods", ->
|
|
|
|
|
spyOn(console, 'error')
|
|
|
|
|
atom.activatePackage('package-with-serialize-error', immediate: true)
|
2013-03-26 21:00:29 +04:00
|
|
|
|
atom.activatePackage('package-with-serialization', immediate: true)
|
2013-03-26 03:55:21 +04:00
|
|
|
|
atom.deactivatePackages()
|
2013-09-26 21:20:17 +04:00
|
|
|
|
expect(atom.packages.packageStates['package-with-serialize-error']).toBeUndefined()
|
|
|
|
|
expect(atom.packages.packageStates['package-with-serialization']).toEqual someNumber: 1
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(console.error).toHaveBeenCalled()
|
|
|
|
|
|
2013-03-26 21:25:09 +04:00
|
|
|
|
it "removes the package's grammars", ->
|
|
|
|
|
atom.activatePackage('package-with-grammars')
|
|
|
|
|
atom.deactivatePackage('package-with-grammars')
|
|
|
|
|
expect(syntax.selectGrammar('a.alot').name).toBe 'Null Grammar'
|
|
|
|
|
expect(syntax.selectGrammar('a.alittle').name).toBe 'Null Grammar'
|
|
|
|
|
|
2013-03-26 22:03:48 +04:00
|
|
|
|
it "removes the package's keymaps", ->
|
|
|
|
|
atom.activatePackage('package-with-keymaps')
|
|
|
|
|
atom.deactivatePackage('package-with-keymaps')
|
|
|
|
|
expect(keymap.bindingsForElement($$ -> @div class: 'test-1')['ctrl-z']).toBeUndefined()
|
|
|
|
|
expect(keymap.bindingsForElement($$ -> @div class: 'test-2')['ctrl-z']).toBeUndefined()
|
|
|
|
|
|
2013-03-26 22:07:05 +04:00
|
|
|
|
it "removes the package's stylesheets", ->
|
|
|
|
|
atom.activatePackage('package-with-stylesheets')
|
|
|
|
|
atom.deactivatePackage('package-with-stylesheets')
|
2013-09-18 06:00:26 +04:00
|
|
|
|
one = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css")
|
|
|
|
|
two = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less")
|
|
|
|
|
three = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css")
|
2013-09-25 19:39:16 +04:00
|
|
|
|
expect(atom.themes.stylesheetElementForId(one)).not.toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(two)).not.toExist()
|
|
|
|
|
expect(atom.themes.stylesheetElementForId(three)).not.toExist()
|
2013-03-26 22:07:05 +04:00
|
|
|
|
|
2013-03-26 22:49:48 +04:00
|
|
|
|
it "removes the package's scoped-properties", ->
|
|
|
|
|
atom.activatePackage("package-with-scoped-properties")
|
|
|
|
|
expect(syntax.getProperty ['.source.omg'], 'editor.increaseIndentPattern').toBe '^a'
|
|
|
|
|
atom.deactivatePackage("package-with-scoped-properties")
|
|
|
|
|
expect(syntax.getProperty ['.source.omg'], 'editor.increaseIndentPattern').toBeUndefined()
|
|
|
|
|
|
2013-08-30 01:44:00 +04:00
|
|
|
|
describe "textmate packages", ->
|
2013-03-26 03:55:21 +04:00
|
|
|
|
it "removes the package's grammars", ->
|
|
|
|
|
expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar"
|
2013-05-29 21:24:34 +04:00
|
|
|
|
atom.activatePackage('ruby-tmbundle', sync: true)
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(syntax.selectGrammar("file.rb").name).toBe "Ruby"
|
2013-05-29 21:24:34 +04:00
|
|
|
|
atom.deactivatePackage('ruby-tmbundle')
|
2013-03-26 03:55:21 +04:00
|
|
|
|
expect(syntax.selectGrammar("file.rb").name).toBe "Null Grammar"
|
2013-02-25 23:25:11 +04:00
|
|
|
|
|
2013-03-27 03:30:42 +04:00
|
|
|
|
it "removes the package's scoped properties", ->
|
2013-05-29 21:24:34 +04:00
|
|
|
|
atom.activatePackage('ruby-tmbundle', sync: true)
|
|
|
|
|
atom.deactivatePackage('ruby-tmbundle')
|
2013-03-27 03:30:42 +04:00
|
|
|
|
expect(syntax.getProperty(['.source.ruby'], 'editor.commentStart')).toBeUndefined()
|