mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
RootView.proto.activateExtension requires extensions to have names
This commit is contained in:
parent
810b9849ee
commit
940b7b0e7a
@ -355,6 +355,9 @@ describe "RootView", ->
|
||||
newRootView.activateExtension(extension)
|
||||
expect(extension.activate).toHaveBeenCalledWith(newRootView, "it worked")
|
||||
|
||||
it "throws an exception if the extension has no 'name' property", ->
|
||||
expect(-> rootView.activateExtension({ activate: -> })).toThrow()
|
||||
|
||||
describe "deactivation", ->
|
||||
it "is deactivated when the rootView is deactivated", ->
|
||||
rootView.activateExtension(extension)
|
||||
|
@ -80,6 +80,7 @@ class RootView extends View
|
||||
when 'Editor' then Editor.deserialize(viewState, this)
|
||||
|
||||
activateExtension: (extension) ->
|
||||
throw new Error("Trying to activate an extension with no name") unless extension.name?
|
||||
@extensions[extension.name] = extension
|
||||
extension.activate(this, @extensionStates[extension.name])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user