Implement split-left

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-03-19 09:22:13 -06:00
parent 9bd6751a46
commit 1437858241
2 changed files with 39 additions and 1 deletions

View File

@@ -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)", ->