mirror of
https://github.com/wassname/nvatom.git
synced 2026-07-30 12:20:52 +08:00
Avoid the user of WorkspaceView in tests
This commit is contained in:
+1
-1
@@ -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": {
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user