mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Merge pull request #14107 from atom/fb-mdt-open-always-adds-item
Always add opened items to the workspace
This commit is contained in:
@@ -93,7 +93,7 @@
|
||||
"autocomplete-plus": "2.35.1",
|
||||
"autocomplete-snippets": "1.11.0",
|
||||
"autoflow": "0.29.0",
|
||||
"autosave": "0.24.1",
|
||||
"autosave": "0.24.2",
|
||||
"background-tips": "0.27.0",
|
||||
"bookmarks": "0.44.3",
|
||||
"bracket-matcher": "0.85.5",
|
||||
@@ -103,7 +103,7 @@
|
||||
"dev-live-reload": "0.47.1",
|
||||
"encoding-selector": "0.23.3",
|
||||
"exception-reporting": "0.41.3",
|
||||
"find-and-replace": "0.207.3",
|
||||
"find-and-replace": "0.207.4",
|
||||
"fuzzy-finder": "1.5.4",
|
||||
"git-diff": "1.3.5",
|
||||
"go-to-line": "0.32.0",
|
||||
@@ -124,7 +124,7 @@
|
||||
"status-bar": "1.8.5",
|
||||
"styleguide": "0.49.6",
|
||||
"symbols-view": "0.115.5",
|
||||
"tabs": "0.105.0",
|
||||
"tabs": "0.105.1",
|
||||
"timecop": "0.36.0",
|
||||
"tree-view": "0.216.0",
|
||||
"update-package-dependencies": "0.11.0",
|
||||
|
||||
@@ -281,6 +281,18 @@ describe('Workspace', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("when the 'activateItem' option is false", () => {
|
||||
it('adds the item to the workspace', () => {
|
||||
let editor
|
||||
waitsForPromise(() => workspace.open('a'))
|
||||
waitsForPromise(() => workspace.open('b', {activateItem: false}).then(o => { editor = o }))
|
||||
runs(() => {
|
||||
expect(workspace.getPaneItems()).toContain(editor)
|
||||
expect(workspace.getActivePaneItem()).not.toBe(editor)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('when the active pane does not have an editor for the given uri', () => {
|
||||
it('adds and activates a new editor for the given path on the active pane', () => {
|
||||
let editor = null
|
||||
|
||||
@@ -719,7 +719,9 @@ module.exports = class Workspace extends Model {
|
||||
|
||||
this.itemOpened(item)
|
||||
|
||||
if (options.activateItem !== false) {
|
||||
if (options.activateItem === false) {
|
||||
pane.addItem(item, {pending: options.pending})
|
||||
} else {
|
||||
pane.activateItem(item, {pending: options.pending})
|
||||
}
|
||||
|
||||
@@ -841,6 +843,13 @@ module.exports = class Workspace extends Model {
|
||||
return this.open(uri, {pane})
|
||||
}
|
||||
|
||||
// Public: Creates a new item that corresponds to the provided URI.
|
||||
//
|
||||
// If no URI is given, or no registered opener can open the URI, a new empty
|
||||
// {TextEditor} will be created.
|
||||
//
|
||||
// * `uri` A {String} containing a URI.
|
||||
//
|
||||
// Returns a {Promise} that resolves to the {TextEditor} (or other item) for the given URI.
|
||||
createItemForURI (uri, options) {
|
||||
if (uri != null) {
|
||||
|
||||
Reference in New Issue
Block a user