Avoid the user of WorkspaceView in tests

This commit is contained in:
Seongjae Lee
2015-05-09 15:41:16 -07:00
parent 66e03ce0e3
commit 6207b379eb
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
"version": "0.1.0",
"private": true,
"contributors": [
"Seongjae Lee <seongjaelee@gmail.com>"
"Seongjae Lee <seongjae@gmail.com>"
],
"description": "Notational Velocity for Atom",
"activationCommands": {
+6 -6
View File
@@ -1,4 +1,3 @@
{WorkspaceView} = require 'atom'
NotationalVelocity = require '../lib/notational-velocity'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
@@ -9,9 +8,10 @@ NotationalVelocity = require '../lib/notational-velocity'
describe "NotationalVelocity", ->
defaultDirectory = atom.config.get('notational-velocity.directory')
activationPromise = null
workspaceElement = null
beforeEach ->
atom.workspaceView = new WorkspaceView
workspaceElement = atom.views.getView(atom.workspace)
activationPromise = atom.packages.activatePackage('notational-velocity')
atom.config.set('notational-velocity.directory', 'testdata')
@@ -20,15 +20,15 @@ describe "NotationalVelocity", ->
describe "when the notational-velocity:toggle event is triggered", ->
it "attaches and then detaches the view", ->
expect(atom.workspaceView.find('.notational-velocity')).not.toExist()
expect(workspaceElement.querySelector('.notational-velocity')).not.toExist()
# This is an activation event, triggering it will cause the package to be
# activated.
atom.commands.dispatch atom.workspaceView.element, 'notational-velocity:toggle'
atom.commands.dispatch workspaceElement, 'notational-velocity:toggle'
waitsForPromise ->
activationPromise
runs ->
expect(atom.workspaceView.find('.notational-velocity')).toExist()
atom.commands.dispatch atom.workspaceView.element, 'notational-velocity:toggle'
expect(workspaceElement.querySelector('.notational-velocity')).toExist()
atom.commands.dispatch workspaceElement, 'notational-velocity:toggle'