mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
add a pane:became-inactive event
This commit is contained in:
@@ -517,6 +517,18 @@ describe "Pane", ->
|
||||
|
||||
expect(becameActiveHandler.callCount).toBe 1
|
||||
|
||||
it "triggers 'pane:became-inactive' when it was previously active", ->
|
||||
becameInactiveHandler = jasmine.createSpy("becameInactiveHandler")
|
||||
container.on 'pane:became-inactive', becameInactiveHandler
|
||||
|
||||
expect(pane.isActive()).toBeFalsy()
|
||||
pane.focusin()
|
||||
expect(pane.isActive()).toBeTruthy()
|
||||
pane.splitRight()
|
||||
expect(pane.isActive()).toBeFalsy()
|
||||
|
||||
expect(becameInactiveHandler.callCount).toBe 1
|
||||
|
||||
describe "split methods", ->
|
||||
[pane1, view3, view4] = []
|
||||
beforeEach ->
|
||||
|
||||
@@ -100,7 +100,9 @@ class Pane extends View
|
||||
@trigger 'pane:became-active' unless wasActive
|
||||
|
||||
makeInactive: ->
|
||||
wasActive = @isActive()
|
||||
@removeClass('active')
|
||||
@trigger 'pane:became-inactive' if wasActive
|
||||
|
||||
isActive: ->
|
||||
@hasClass('active')
|
||||
|
||||
Reference in New Issue
Block a user