mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Implement split-left
This commit is contained in:
@@ -62,6 +62,33 @@ describe "RootView", ->
|
||||
expect(editor1.lines.find('.line:first').text()).toContain 'ABC'
|
||||
expect(editor2.lines.find('.line:first').text()).toContain 'ABC'
|
||||
|
||||
describe "when split-left is triggered on the editor", ->
|
||||
it "places the a new editor to the left of the current editor in a .horizontal div, and focuses the new editor", ->
|
||||
rootView.attachToDom()
|
||||
|
||||
expect(rootView.find('.horizontal')).not.toExist()
|
||||
|
||||
editor1 = rootView.find('.editor').view()
|
||||
editor1.setBuffer(new Buffer(require.resolve 'fixtures/sample.js'))
|
||||
editor1.setCursorScreenPosition([3, 2])
|
||||
editor1.trigger 'split-left'
|
||||
|
||||
expect(rootView.find('.horizontal')).toExist()
|
||||
expect(rootView.find('.horizontal .editor').length).toBe 2
|
||||
expect(rootView.find('.horizontal .editor:eq(1)').view()).toBe editor1
|
||||
editor2 = rootView.find('.horizontal .editor:eq(0)').view()
|
||||
expect(editor2.buffer).toBe editor1.buffer
|
||||
expect(editor2.getCursorScreenPosition()).toEqual [3, 2]
|
||||
expect(editor1).toHaveClass 'split'
|
||||
expect(editor2).toHaveClass 'split'
|
||||
|
||||
expect(editor1.has(':focus')).not.toExist()
|
||||
expect(editor2.has(':focus')).toExist()
|
||||
|
||||
# insertion reflected in both buffers
|
||||
editor1.buffer.insert([0, 0], 'ABC')
|
||||
expect(editor1.lines.find('.line:first').text()).toContain 'ABC'
|
||||
expect(editor2.lines.find('.line:first').text()).toContain 'ABC'
|
||||
|
||||
describe ".addPane(view)", ->
|
||||
it "adds the given view to the rootView (at the bottom by default)", ->
|
||||
|
||||
Reference in New Issue
Block a user