mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03:00
Don't activate autocomplete on its own mini editor
This commit is contained in:
parent
41a5f217a5
commit
f0c36ada89
@ -18,14 +18,16 @@ describe "Autocomplete", ->
|
||||
afterEach ->
|
||||
autocomplete.remove()
|
||||
|
||||
describe '@activate(rootView)', ->
|
||||
it 'activates autocomplete on all existing and future editors', ->
|
||||
describe "@activate(rootView)", ->
|
||||
it "activates autocomplete on all existing and future editors (but not on autocomplete's own mini editor)", ->
|
||||
rootView = new RootView(pathToOpen: require.resolve('fixtures/sample.js'))
|
||||
rootView.simulateDomAttachment()
|
||||
Autocomplete.activate(rootView)
|
||||
leftEditor = rootView.activeEditor()
|
||||
rightEditor = rootView.activeEditor().splitRight()
|
||||
|
||||
spyOn(Autocomplete.prototype, 'initialize')
|
||||
|
||||
leftEditor.trigger 'autocomplete:attach'
|
||||
expect(leftEditor.find('.autocomplete')).toExist()
|
||||
expect(rightEditor.find('.autocomplete')).not.toExist()
|
||||
@ -35,6 +37,8 @@ describe "Autocomplete", ->
|
||||
expect(leftEditor.find('.autocomplete')).not.toExist()
|
||||
expect(rightEditor.find('.autocomplete')).toExist()
|
||||
|
||||
expect(Autocomplete.prototype.initialize).not.toHaveBeenCalled()
|
||||
|
||||
describe 'autocomplete:attach event', ->
|
||||
it "shows autocomplete view and focuses its mini-editor", ->
|
||||
expect(editor.find('.autocomplete')).not.toExist()
|
||||
|
@ -26,7 +26,8 @@ class Autocomplete extends View
|
||||
|
||||
@activate: (rootView) ->
|
||||
new Autocomplete(editor) for editor in rootView.editors()
|
||||
rootView.on 'editor-open', (e, editor) -> new Autocomplete(editor)
|
||||
rootView.on 'editor-open', (e, editor) ->
|
||||
new Autocomplete(editor) unless editor.is('.autocomplete .mini')
|
||||
|
||||
initialize: (@editor) ->
|
||||
requireStylesheet 'autocomplete.css'
|
||||
|
Loading…
Reference in New Issue
Block a user