From 6207b379ebc03d0d21032b1a001f6a63f34ab233 Mon Sep 17 00:00:00 2001 From: Seongjae Lee Date: Sat, 9 May 2015 15:41:16 -0700 Subject: [PATCH] Avoid the user of WorkspaceView in tests --- package.json | 2 +- spec/notational-velocity-spec.coffee | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index dd9b8aa..f438a4b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.1.0", "private": true, "contributors": [ - "Seongjae Lee " + "Seongjae Lee " ], "description": "Notational Velocity for Atom", "activationCommands": { diff --git a/spec/notational-velocity-spec.coffee b/spec/notational-velocity-spec.coffee index 21a5112..408c5e8 100644 --- a/spec/notational-velocity-spec.coffee +++ b/spec/notational-velocity-spec.coffee @@ -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'