mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add tests for moving to end of selection
This commit is contained in:
committed by
Corey Johnson & Matt Colyer
parent
a689a5906e
commit
226a4bf391
@@ -187,6 +187,18 @@ describe "EditSession", ->
|
||||
editSession.moveCursorLeft()
|
||||
expect(editSession.getCursorBufferPosition()).toEqual [5, 4]
|
||||
|
||||
describe "when there is a selection", ->
|
||||
beforeEach ->
|
||||
editSession.setSelectedBufferRange([[5, 22],[5, 27]])
|
||||
|
||||
it "moves to the left of the selection", ->
|
||||
cursor = editSession.getCursor()
|
||||
editSession.moveCursorLeft()
|
||||
expect(cursor.getBufferPosition()).toEqual [5, 22]
|
||||
|
||||
editSession.moveCursorLeft()
|
||||
expect(cursor.getBufferPosition()).toEqual [5, 21]
|
||||
|
||||
it "merges cursors when they overlap", ->
|
||||
editSession.setCursorScreenPosition([0, 0])
|
||||
editSession.addCursorAtScreenPosition([0, 1])
|
||||
@@ -221,6 +233,18 @@ describe "EditSession", ->
|
||||
|
||||
expect(editSession.getCursorScreenPosition()).toEqual(lastPosition)
|
||||
|
||||
describe "when there is a selection", ->
|
||||
beforeEach ->
|
||||
editSession.setSelectedBufferRange([[5, 22],[5, 27]])
|
||||
|
||||
it "moves to the left of the selection", ->
|
||||
cursor = editSession.getCursor()
|
||||
editSession.moveCursorRight()
|
||||
expect(cursor.getBufferPosition()).toEqual [5, 27]
|
||||
|
||||
editSession.moveCursorRight()
|
||||
expect(cursor.getBufferPosition()).toEqual [5, 28]
|
||||
|
||||
it "merges cursors when they overlap", ->
|
||||
editSession.setCursorScreenPosition([12, 2])
|
||||
editSession.addCursorAtScreenPosition([12, 1])
|
||||
|
||||
Reference in New Issue
Block a user