Skip to content

Commit

Permalink
fix: add activation hook
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Nov 21, 2020
1 parent 4d3ef9f commit ee3e5d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"viewProviders": [
"minimapViewProvider"
],
"activationHooks": [
"core:loaded-shell-environment"
],
"configSchema": {
"plugins": {
"type": "object",
Expand Down
9 changes: 9 additions & 0 deletions spec/minimap-element-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ describe('MinimapElement', () => {
? document.body.querySelector('#jasmine-content')
: document.body


// Package activation will be deferred to the configured, activation hook, which is then triggered
// Activate activation hook
atom.packages.triggerDeferredActivationHooks();
atom.packages.triggerActivationHook("core:loaded-shell-environment");
waitsForPromise(() => atom.packages.activatePackage('minimap'))

runs(() => {
Expand Down Expand Up @@ -1949,6 +1954,10 @@ describe('MinimapElement', () => {
describe('with plugins registered in the package', () => {
let [minimapPackage, pluginA, pluginB] = []
beforeEach(() => {
// Package activation will be deferred to the configured, activation hook, which is then triggered
// Activate activation hook
atom.packages.triggerDeferredActivationHooks();
atom.packages.triggerActivationHook("core:loaded-shell-environment");
waitsForPromise(() => {
return atom.packages.activatePackage('minimap').then((pkg) => {
minimapPackage = pkg.mainModule
Expand Down
8 changes: 8 additions & 0 deletions spec/minimap-main-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ describe('Minimap package', () => {
return atom.workspace.open('sample.coffee')
})

// Package activation will be deferred to the configured, activation hook, which is then triggered
// Activate activation hook
atom.packages.triggerDeferredActivationHooks();
atom.packages.triggerActivationHook("core:loaded-shell-environment");
waitsForPromise(() => {
return atom.packages.activatePackage('minimap').then((pkg) => {
minimapPackage = pkg.mainModule
Expand Down Expand Up @@ -66,6 +70,10 @@ describe('Minimap package', () => {
const m = new Minimap({textEditor: editor})
const v = atom.views.getView(m)
editorElement.appendChild(v)
// Package activation will be deferred to the configured, activation hook, which is then triggered
// Activate activation hook
atom.packages.triggerDeferredActivationHooks();
atom.packages.triggerActivationHook("core:loaded-shell-environment");
waitsForPromise(() => atom.packages.activatePackage('minimap'))
})

Expand Down

0 comments on commit ee3e5d7

Please sign in to comment.