mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Merge pull request #16295 from xfontes42/master
Add event handler for window resizing.
This commit is contained in:
@@ -44,7 +44,15 @@ describe('WindowEventHandler', () => {
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
describe('resize event', () =>
|
||||
it('calls storeWindowDimensions', () => {
|
||||
spyOn(atom, 'storeWindowDimensions')
|
||||
window.dispatchEvent(new CustomEvent('resize'))
|
||||
expect(atom.storeWindowDimensions).toHaveBeenCalled()
|
||||
})
|
||||
)
|
||||
|
||||
describe('window:close event', () =>
|
||||
it('closes the window', () => {
|
||||
spyOn(atom, 'close')
|
||||
|
||||
@@ -9,6 +9,7 @@ class WindowEventHandler {
|
||||
this.handleFocusNext = this.handleFocusNext.bind(this)
|
||||
this.handleFocusPrevious = this.handleFocusPrevious.bind(this)
|
||||
this.handleWindowBlur = this.handleWindowBlur.bind(this)
|
||||
this.handleWindowResize = this.handleWindowResize.bind(this)
|
||||
this.handleEnterFullScreen = this.handleEnterFullScreen.bind(this)
|
||||
this.handleLeaveFullScreen = this.handleLeaveFullScreen.bind(this)
|
||||
this.handleWindowBeforeunload = this.handleWindowBeforeunload.bind(this)
|
||||
@@ -51,6 +52,7 @@ class WindowEventHandler {
|
||||
this.addEventListener(this.window, 'beforeunload', this.handleWindowBeforeunload)
|
||||
this.addEventListener(this.window, 'focus', this.handleWindowFocus)
|
||||
this.addEventListener(this.window, 'blur', this.handleWindowBlur)
|
||||
this.addEventListener(this.window, 'resize', this.handleWindowResize)
|
||||
|
||||
this.addEventListener(this.document, 'keyup', this.handleDocumentKeyEvent)
|
||||
this.addEventListener(this.document, 'keydown', this.handleDocumentKeyEvent)
|
||||
@@ -189,6 +191,10 @@ class WindowEventHandler {
|
||||
this.atomEnvironment.storeWindowDimensions()
|
||||
}
|
||||
|
||||
handleWindowResize () {
|
||||
this.atomEnvironment.storeWindowDimensions()
|
||||
}
|
||||
|
||||
handleEnterFullScreen () {
|
||||
this.document.body.classList.add('fullscreen')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user