mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Don't use workspace's itemLocationStore in tests
This commit is contained in:
@@ -294,6 +294,15 @@ describe('Workspace', () => {
|
||||
})
|
||||
|
||||
describe('when the active pane does not have an editor for the given uri', () => {
|
||||
beforeEach(() => {
|
||||
atom.workspace.enablePersistence = true
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
await atom.workspace.itemLocationStore.clear()
|
||||
atom.workspace.enablePersistence = false
|
||||
})
|
||||
|
||||
it('adds and activates a new editor for the given path on the active pane', () => {
|
||||
let editor = null
|
||||
waitsForPromise(() => workspace.open('a').then(o => { editor = o }))
|
||||
|
||||
@@ -173,7 +173,7 @@ class AtomEnvironment extends Model
|
||||
@workspace = new Workspace({
|
||||
@config, @project, packageManager: @packages, grammarRegistry: @grammars, deserializerManager: @deserializers,
|
||||
notificationManager: @notifications, @applicationDelegate, viewRegistry: @views, assert: @assert.bind(this),
|
||||
textEditorRegistry: @textEditors, styleManager: @styles
|
||||
textEditorRegistry: @textEditors, styleManager: @styles, @enablePersistence
|
||||
})
|
||||
|
||||
@themes.workspace = @workspace
|
||||
|
||||
@@ -42,6 +42,7 @@ module.exports = class Workspace extends Model {
|
||||
this.didActivatePaneContainer = this.didActivatePaneContainer.bind(this)
|
||||
this.didHideDock = this.didHideDock.bind(this)
|
||||
|
||||
this.enablePersistence = params.enablePersistence
|
||||
this.packageManager = params.packageManager
|
||||
this.config = params.config
|
||||
this.project = params.project
|
||||
@@ -359,9 +360,9 @@ module.exports = class Workspace extends Model {
|
||||
for (const paneContainer of this.getPaneContainers()) {
|
||||
paneContainer.observePanes(pane => {
|
||||
pane.onDidAddItem(({item}) => {
|
||||
if (typeof item.getURI === 'function') {
|
||||
if (typeof item.getURI === 'function' && this.enablePersistence) {
|
||||
const uri = item.getURI()
|
||||
if (uri != null) {
|
||||
if (uri) {
|
||||
const location = paneContainer.getLocation()
|
||||
let defaultLocation
|
||||
if (typeof item.getDefaultLocation === 'function') {
|
||||
@@ -782,7 +783,7 @@ module.exports = class Workspace extends Model {
|
||||
pane = options.pane
|
||||
} else {
|
||||
let location = options.location
|
||||
if (!location && !options.split && uri) {
|
||||
if (!location && !options.split && uri && this.enablePersistence) {
|
||||
location = await this.itemLocationStore.load(uri)
|
||||
}
|
||||
if (!location && typeof item.getDefaultLocation === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user