           [mainModule, promise] = []
 
           beforeEach ->
+            atom.workspaceView.attachToDom()
             mainModule = require './fixtures/packages/package-with-activation-events/index'
             spyOn(mainModule, 'activate').andCallThrough()
             spyOn(Package.prototype, 'requireMainModule').andCallThrough()

              editorView = atom.workspaceView.getActiveView()
              eventHandler = jasmine.createSpy("activation-event")
              editorView.command 'activation-event', eventHandler
              editorView.trigger 'activation-event'
              expect(mainModule.activate.callCount).toBe 1
              expect(mainModule.activationEventCallCount).toBe 1
              expect(eventHandler.callCount).toBe 1
              editorView.trigger 'activation-event'
              expect(mainModule.activationEventCallCount).toBe 2
              expect(eventHandler.callCount).toBe 2
              expect(mainModule.activate.callCount).toBe 1


          it "defers requiring/activating the main module until an activation event bubbles to the root view", ->
            expect(promise.isFulfilled()).not.toBeTruthy()
            atom.workspaceView[0].dispatchEvent(new CustomEvent('activation-event', bubbles: true))

            waitsForPromise ->
              promise
