mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Do not clobber recent project history when running specs
This commit is contained in:
@@ -11,6 +11,9 @@ describe("HistoryManager", () => {
|
||||
let commandDisposable, projectDisposable
|
||||
|
||||
beforeEach(async () => {
|
||||
// Do not clobber recent project history
|
||||
spyOn(atom.applicationDelegate, 'didChangeHistoryManager')
|
||||
|
||||
commandDisposable = jasmine.createSpyObj('Disposable', ['dispose'])
|
||||
commandRegistry = jasmine.createSpyObj('CommandRegistry', ['add'])
|
||||
commandRegistry.add.andReturn(commandDisposable)
|
||||
|
||||
@@ -61,6 +61,9 @@ else
|
||||
specProjectPath = require('os').tmpdir()
|
||||
|
||||
beforeEach ->
|
||||
# Do not clobber recent project history
|
||||
spyOn(atom.history, 'saveState').andReturn(Promise.resolve())
|
||||
|
||||
atom.project.setPaths([specProjectPath])
|
||||
|
||||
window.resetTimeouts()
|
||||
|
||||
@@ -50,8 +50,8 @@ export class HistoryManager {
|
||||
return this.emitter.on('did-change-projects', callback)
|
||||
}
|
||||
|
||||
didChangeProjects (args) {
|
||||
this.emitter.emit('did-change-projects', args || { reloaded: false })
|
||||
didChangeProjects (args = {reloaded: false}) {
|
||||
this.emitter.emit('did-change-projects', args)
|
||||
}
|
||||
|
||||
async addProject (paths, lastOpened) {
|
||||
@@ -93,7 +93,7 @@ export class HistoryManager {
|
||||
}
|
||||
|
||||
async loadState () {
|
||||
let history = await this.stateStore.load('history-manager')
|
||||
const history = await this.stateStore.load('history-manager')
|
||||
if (history && history.projects) {
|
||||
this.projects = history.projects.filter(p => Array.isArray(p.paths) && p.paths.length > 0).map(p => new HistoryProject(p.paths, new Date(p.lastOpened)))
|
||||
this.didChangeProjects({reloaded: true})
|
||||
|
||||
Reference in New Issue
Block a user