mirror of
https://github.com/atom/atom.git
synced 2026-01-22 13:28:01 -05:00
Focus the active center pane when hiding a dock
This commit is contained in:
@@ -16,6 +16,18 @@ describe('Dock', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when a dock is hidden', () => {
|
||||
it('transfers focus back to the active center pane', () => {
|
||||
jasmine.attachToDOM(atom.workspace.getElement())
|
||||
const dock = atom.workspace.getLeftDock()
|
||||
dock.activate()
|
||||
expect(document.activeElement).toBe(dock.getActivePane().getElement())
|
||||
|
||||
dock.hide()
|
||||
expect(document.activeElement).toBe(atom.workspace.getCenter().getActivePane().getElement())
|
||||
})
|
||||
})
|
||||
|
||||
describe('when a pane in a dock is activated', () => {
|
||||
it('opens the dock', async () => {
|
||||
const item = {
|
||||
|
||||
@@ -33,6 +33,7 @@ module.exports = class Dock {
|
||||
this.deserializerManager = params.deserializerManager
|
||||
this.notificationManager = params.notificationManager
|
||||
this.viewRegistry = params.viewRegistry
|
||||
this.didHide = params.didHide
|
||||
|
||||
this.paneContainer = new PaneContainer({
|
||||
location: this.location,
|
||||
@@ -103,6 +104,7 @@ module.exports = class Dock {
|
||||
|
||||
hide () {
|
||||
this.setState({open: false})
|
||||
this.didHide()
|
||||
}
|
||||
|
||||
toggle () {
|
||||
|
||||
@@ -36,6 +36,7 @@ module.exports = class Workspace extends Model {
|
||||
this.updateDocumentEdited = this.updateDocumentEdited.bind(this)
|
||||
this.didDestroyPaneItem = this.didDestroyPaneItem.bind(this)
|
||||
this.didChangeActivePaneItem = this.didChangeActivePaneItem.bind(this)
|
||||
this.didHideDock = this.didHideDock.bind(this)
|
||||
|
||||
this.packageManager = params.packageManager
|
||||
this.config = params.config
|
||||
@@ -112,12 +113,17 @@ module.exports = class Workspace extends Model {
|
||||
applicationDelegate: this.applicationDelegate,
|
||||
deserializerManager: this.deserializerManager,
|
||||
notificationManager: this.notificationManager,
|
||||
viewRegistry: this.viewRegistry
|
||||
viewRegistry: this.viewRegistry,
|
||||
didHide: this.didHideDock
|
||||
})
|
||||
dock.onDidDestroyPaneItem(this.didDestroyPaneItem)
|
||||
return dock
|
||||
}
|
||||
|
||||
didHideDock () {
|
||||
this.getCenter().getActivePane().activate()
|
||||
}
|
||||
|
||||
reset (packageManager) {
|
||||
this.packageManager = packageManager
|
||||
this.emitter.dispose()
|
||||
|
||||
Reference in New Issue
Block a user