mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Focus the active pane of docks when they are activated
This commit is contained in:
committed by
Max Brunsfeld
parent
334290aaa7
commit
88422ee4c9
@@ -3,13 +3,27 @@
|
||||
import {it, fit, ffit, fffit, beforeEach, afterEach} from './async-spec-helpers'
|
||||
|
||||
describe('Dock', () => {
|
||||
describe('when a dock is activated', () => {
|
||||
it('opens the dock and activates its active pane', () => {
|
||||
jasmine.attachToDOM(atom.views.getView(atom.workspace))
|
||||
const dock = atom.workspace.getLeftDock()
|
||||
|
||||
expect(dock.isOpen()).toBe(false)
|
||||
expect(document.activeElement).toBe(atom.views.getView(atom.workspace.getCenter().getActivePane()))
|
||||
dock.activate()
|
||||
expect(dock.isOpen()).toBe(true)
|
||||
expect(document.activeElement).toBe(atom.views.getView(dock.getActivePane()))
|
||||
})
|
||||
})
|
||||
|
||||
describe('when a pane in a dock is activated', () => {
|
||||
it('opens the dock', () => {
|
||||
it('opens the dock', async () => {
|
||||
const item = {
|
||||
element: document.createElement('div'),
|
||||
getDefaultLocation() { return 'left' }
|
||||
}
|
||||
|
||||
atom.workspace.open(item, {activatePane: false})
|
||||
await atom.workspace.open(item, {activatePane: false})
|
||||
expect(atom.workspace.getLeftDock().isOpen()).toBe(false)
|
||||
|
||||
atom.workspace.getLeftDock().getPanes()[0].activate()
|
||||
|
||||
@@ -49,7 +49,7 @@ module.exports = class Dock {
|
||||
}
|
||||
|
||||
this.subscriptions = new CompositeDisposable(
|
||||
this.paneContainer.onDidActivatePane(() => this.activate()),
|
||||
this.paneContainer.onDidActivatePane(() => this.open()),
|
||||
this.paneContainer.observePanes(pane => {
|
||||
pane.onDidRemoveItem(this.handleDidRemovePaneItem.bind(this))
|
||||
})
|
||||
@@ -93,6 +93,11 @@ module.exports = class Dock {
|
||||
}
|
||||
|
||||
activate () {
|
||||
this.open()
|
||||
this.getActivePane().activate()
|
||||
}
|
||||
|
||||
open () {
|
||||
this.setState({open: true})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user