Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #16141 from atom/mb-decaf-atom-environment
Browse files Browse the repository at this point in the history
Convert AtomEnvironment to JS
  • Loading branch information
Max Brunsfeld committed Nov 9, 2017
2 parents fd15062 + fed595b commit 6c99872
Show file tree
Hide file tree
Showing 3 changed files with 1,341 additions and 1,189 deletions.
23 changes: 2 additions & 21 deletions spec/atom-environment-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,25 +224,6 @@ describe('AtomEnvironment', () => {
expect(await atom.loadState()).toEqual({stuff: 'cool'})
})

it("loads state from the storage folder when it can't be found in atom.stateStore", async () => {
jasmine.useRealClock()

const storageFolderState = {foo: 1, bar: 2}
const serializedState = {someState: 42}
const loadSettings = _.extend(atom.getLoadSettings(), {initialPaths: [temp.mkdirSync('project-directory')]})
spyOn(atom, 'getLoadSettings').andReturn(loadSettings)
spyOn(atom, 'serialize').andReturn(serializedState)
spyOn(atom, 'getStorageFolder').andReturn(new StorageFolder(temp.mkdirSync('config-directory')))
atom.project.setPaths(atom.getLoadSettings().initialPaths)

await atom.stateStore.connect()
atom.getStorageFolder().storeSync(atom.getStateKey(loadSettings.initialPaths), storageFolderState)
expect(await atom.loadState()).toEqual(storageFolderState)

await atom.saveState()
expect(await atom.loadState()).toEqual(serializedState)
})

it('saves state when the CPU is idle after a keydown or mousedown event', () => {
const atomEnv = new AtomEnvironment({
applicationDelegate: global.atom.applicationDelegate
Expand Down Expand Up @@ -488,7 +469,7 @@ describe('AtomEnvironment', () => {
})

it('automatically restores the saved state into the current environment', () => {
const state = Symbol()
const state = {}
spyOn(atom.workspace, 'open')
spyOn(atom, 'restoreStateIntoThisEnvironment')

Expand All @@ -505,7 +486,7 @@ describe('AtomEnvironment', () => {
getTitle () { return 'title' },
element: document.createElement('div')
})
const state = Symbol()
const state = {}
spyOn(atom, 'confirm')
atom.attemptRestoreProjectStateForPaths(state, [__dirname], [__filename])
expect(atom.confirm).not.toHaveBeenCalled()
Expand Down
Loading

0 comments on commit 6c99872

Please sign in to comment.