mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Clear mini editor when detaching
This commit is contained in:
@@ -115,6 +115,7 @@ class CommandPanelView extends View
|
||||
@miniEditor.setCursorBufferPosition([0, Infinity])
|
||||
|
||||
detach: ->
|
||||
@miniEditor.setText('')
|
||||
rootView.focus()
|
||||
@previewList.hide()
|
||||
@previewHeader.hide()
|
||||
|
||||
@@ -72,7 +72,8 @@ describe "CommandPanel", ->
|
||||
|
||||
describe "when core:close is triggered on the command panel", ->
|
||||
it "detaches the command panel, focuses the RootView and does not bubble the core:close event", ->
|
||||
commandPanel.attach()
|
||||
commandPanel.attach('command')
|
||||
expect(commandPanel.miniEditor.getText()).toBe 'command'
|
||||
rootViewCloseHandler = jasmine.createSpy('rootViewCloseHandler')
|
||||
rootView.on 'core:close', rootViewCloseHandler
|
||||
spyOn(rootView, 'focus')
|
||||
@@ -82,10 +83,12 @@ describe "CommandPanel", ->
|
||||
expect(rootView.focus).toHaveBeenCalled()
|
||||
expect(rootViewCloseHandler).not.toHaveBeenCalled()
|
||||
expect(commandPanel.hasParent()).toBeFalsy()
|
||||
expect(commandPanel.miniEditor.getText()).toBe ''
|
||||
|
||||
describe "when core:cancel is triggered on the command panel's mini editor", ->
|
||||
it "detaches the command panel, focuses the RootView and does not bubble the core:cancel event", ->
|
||||
commandPanel.attach()
|
||||
commandPanel.attach('command')
|
||||
expect(commandPanel.miniEditor.getText()).toBe 'command'
|
||||
rootViewCancelHandler = jasmine.createSpy('rootViewCancelHandler')
|
||||
rootView.on 'core:cancel', rootViewCancelHandler
|
||||
spyOn(rootView, 'focus')
|
||||
@@ -95,6 +98,7 @@ describe "CommandPanel", ->
|
||||
expect(rootView.focus).toHaveBeenCalled()
|
||||
expect(rootViewCancelHandler).not.toHaveBeenCalled()
|
||||
expect(commandPanel.hasParent()).toBeFalsy()
|
||||
expect(commandPanel.miniEditor.getText()).toBe ''
|
||||
|
||||
describe "when command-panel:toggle is triggered on the root view", ->
|
||||
beforeEach ->
|
||||
|
||||
Reference in New Issue
Block a user