Skip to content

Instantly share code, notes, and snippets.

@eddorre
Last active August 29, 2015 13:56
Show Gist options
  • Save eddorre/9317307 to your computer and use it in GitHub Desktop.
Save eddorre/9317307 to your computer and use it in GitHub Desktop.
{WorkspaceView} = require 'atom'
MyPackage = require '../lib/my-package'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "MyPackage", ->
activationPromise = null
beforeEach ->
atom.workspaceView = new WorkspaceView
activationPromise = atom.packages.activatePackage('my-package')
describe "when the my-package:toggle event is triggered", ->
it "attaches and then detaches the view", ->
expect(atom.workspaceView.find('.my-package')).not.toExist()
# This is an activation event, triggering it will cause the package to be
# activated.
atom.workspaceView.trigger 'my-package:toggle'
waitsForPromise ->
activationPromise
runs ->
expect(atom.workspaceView.find('.my-package')).toExist()
atom.workspaceView.trigger 'my-package:toggle'
expect(atom.workspaceView.find('.my-package')).not.toExist()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment