Fix remaining tests

This commit is contained in:
Antonio Scandurra
2017-03-12 11:49:48 +01:00
parent b1704ee7e6
commit ea440148d8
5 changed files with 15 additions and 11 deletions

View File

@@ -12,8 +12,8 @@ describe("HistoryManager", () => {
beforeEach(async () => {
commandDisposable = jasmine.createSpyObj('Disposable', ['dispose'])
commandRegistry = jasmine.createSpyObj('CommandRegistry', ['add'])
commandRegistry.add.andReturn(commandDisposable)
commandRegistry = jasmine.createSpyObj('CommandRegistry', ['addBundled'])
commandRegistry.addBundled.andReturn(commandDisposable)
stateStore = new StateStore('history-manager-test', 1)
await stateStore.save('history-manager', {
@@ -31,7 +31,7 @@ describe("HistoryManager", () => {
})
historyManager = new HistoryManager({stateStore, project, commands: commandRegistry})
historyManager.initialize({localStorage: window.localStorage})
historyManager.initialize(window.localStorage)
await historyManager.loadState()
})
@@ -41,8 +41,8 @@ describe("HistoryManager", () => {
describe("constructor", () => {
it("registers the 'clear-project-history' command function", () => {
expect(commandRegistry.add).toHaveBeenCalled()
const cmdCall = commandRegistry.add.calls[0]
expect(commandRegistry.addBundled).toHaveBeenCalled()
const cmdCall = commandRegistry.addBundled.calls[0]
expect(cmdCall.args.length).toBe(2)
expect(cmdCall.args[0]).toBe('atom-workspace')
expect(typeof cmdCall.args[1]['application:clear-project-history']).toBe('function')

View File

@@ -5,11 +5,8 @@ describe "MenuManager", ->
menu = null
beforeEach ->
menu = new MenuManager(
resourcePath: atom.getLoadSettings().resourcePath
keymapManager: atom.keymaps
packageManager: atom.packages
)
menu = new MenuManager({keymapManager: atom.keymaps, packageManager: atom.packages})
menu.initialize({resourcePath: atom.getLoadSettings().resourcePath})
describe "::add(items)", ->
it "can add new menus that can be removed with the returned disposable", ->

View File

@@ -5,6 +5,7 @@ describe "ViewRegistry", ->
beforeEach ->
registry = new ViewRegistry
registry.initialize()
afterEach ->
registry.clearDocumentRequests()

View File

@@ -15,7 +15,8 @@ describe "WindowEventHandler", ->
loadSettings.initialPath = initialPath
loadSettings
atom.project.destroy()
windowEventHandler = new WindowEventHandler({atomEnvironment: atom, applicationDelegate: atom.applicationDelegate, window, document})
windowEventHandler = new WindowEventHandler({atomEnvironment: atom, applicationDelegate: atom.applicationDelegate})
windowEventHandler.initialize(window, document)
afterEach ->
windowEventHandler.unsubscribe()

View File

@@ -792,8 +792,13 @@ class AtomEnvironment extends Model
uninstallUncaughtErrorHandler: ->
@window.onerror = @previousWindowErrorHandler
installWindowEventHandler: ->
@windowEventHandler = new WindowEventHandler({atomEnvironment: this, @applicationDelegate})
@windowEventHandler.initialize(@window, @document)
uninstallWindowEventHandler: ->
@windowEventHandler?.unsubscribe()
@windowEventHandler = null
###
Section: Messaging the User