mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Use global rootView in GoToLineView
This commit is contained in:
@@ -6,15 +6,15 @@ Point = require 'point'
|
||||
module.exports =
|
||||
class GoToLineView extends View
|
||||
|
||||
@activate: (rootView) -> new GoToLineView(rootView)
|
||||
@activate: -> new GoToLineView
|
||||
|
||||
@content: ->
|
||||
@div class: 'go-to-line overlay from-top mini', =>
|
||||
@subview 'miniEditor', new Editor(mini: true)
|
||||
@div class: 'message', outlet: 'message'
|
||||
|
||||
initialize: (@rootView) ->
|
||||
@rootView.command 'editor:go-to-line', '.editor', => @toggle()
|
||||
initialize: ->
|
||||
rootView.command 'editor:go-to-line', '.editor', => @toggle()
|
||||
@miniEditor.on 'focusout', => @detach()
|
||||
@on 'core:confirm', => @confirm()
|
||||
@on 'core:cancel', => @detach()
|
||||
@@ -50,6 +50,6 @@ class GoToLineView extends View
|
||||
|
||||
attach: ->
|
||||
@previouslyFocusedElement = $(':focus')
|
||||
@rootView.append(this)
|
||||
@message.text("Enter a line number 1-#{@rootView.getActiveEditor().getLineCount()}")
|
||||
rootView.append(this)
|
||||
@message.text("Enter a line number 1-#{rootView.getActiveEditor().getLineCount()}")
|
||||
@miniEditor.focus()
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
RootView = require 'root-view'
|
||||
GoToLineView = require 'go-to-line/lib/go-to-line-view'
|
||||
|
||||
describe 'GoToLine', ->
|
||||
[rootView, goToLine, editor] = []
|
||||
[goToLine, editor] = []
|
||||
|
||||
beforeEach ->
|
||||
rootView = new RootView(require.resolve('fixtures/sample.js'))
|
||||
new RootView(require.resolve('fixtures/sample.js'))
|
||||
rootView.enableKeymap()
|
||||
atom.loadPackage("go-to-line")
|
||||
editor = rootView.getActiveEditor()
|
||||
editor.trigger 'editor:go-to-line'
|
||||
goToLine = rootView.find('.go-to-line').view()
|
||||
editor.trigger 'editor:go-to-line'
|
||||
goToLine = GoToLineView.activate()
|
||||
editor.setCursorBufferPosition([1,0])
|
||||
|
||||
afterEach ->
|
||||
|
||||
Reference in New Issue
Block a user