Reenable undo, redo, and transaction specs

This commit is contained in:
Kevin Sawicki
2013-11-05 16:29:27 -08:00
parent 2be5790311
commit efb87237e2

View File

@@ -2065,7 +2065,7 @@ describe "EditSession", ->
editSession.toggleLineCommentsInSelection()
expect(buffer.lineForRow(10)).toBe " "
xdescribe ".undo() and .redo()", ->
describe ".undo() and .redo()", ->
it "undoes/redoes the last change", ->
editSession.insertText("foo")
editSession.undo()
@@ -2113,7 +2113,7 @@ describe "EditSession", ->
editSession.redo()
expect(editSession.getSelectedBufferRanges()).toEqual [[[1, 6], [1, 6]], [[1, 18], [1, 18]]]
it "restores folds after undo and redo", ->
xit "restores folds after undo and redo", ->
editSession.foldBufferRow(1)
editSession.setSelectedBufferRange([[1, 0], [10, Infinity]], preserveFolds: true)
expect(editSession.isFoldedAtBufferRow(1)).toBeTruthy()
@@ -2136,27 +2136,26 @@ describe "EditSession", ->
expect(editSession.isFoldedAtBufferRow(1)).toBeFalsy()
expect(editSession.isFoldedAtBufferRow(2)).toBeTruthy()
xdescribe ".transact([fn])", ->
describe "when called without a function", ->
it "restores the selection when the transaction is undone/redone", ->
buffer.setText('1234')
editSession.setSelectedBufferRange([[0, 1], [0, 3]])
editSession.transact()
describe "begin/commitTransaction()", ->
it "restores the selection when the transaction is undone/redone", ->
buffer.setText('1234')
editSession.setSelectedBufferRange([[0, 1], [0, 3]])
editSession.beginTransaction()
editSession.delete()
editSession.moveCursorToEndOfLine()
editSession.insertText('5')
expect(buffer.getText()).toBe '145'
editSession.delete()
editSession.moveCursorToEndOfLine()
editSession.insertText('5')
expect(buffer.getText()).toBe '145'
editSession.commit()
editSession.commitTransaction()
editSession.undo()
expect(buffer.getText()).toBe '1234'
expect(editSession.getSelectedBufferRange()).toEqual [[0, 1], [0, 3]]
editSession.undo()
expect(buffer.getText()).toBe '1234'
expect(editSession.getSelectedBufferRange()).toEqual [[0, 1], [0, 3]]
editSession.redo()
expect(buffer.getText()).toBe '145'
expect(editSession.getSelectedBufferRange()).toEqual [[0, 3], [0, 3]]
editSession.redo()
expect(buffer.getText()).toBe '145'
expect(editSession.getSelectedBufferRange()).toEqual [[0, 3], [0, 3]]
describe "when the buffer is changed (via its direct api, rather than via than edit session)", ->
it "moves the cursor so it is in the same relative position of the buffer", ->
@@ -2277,7 +2276,7 @@ describe "EditSession", ->
expect(buffer.lineForRow(6)).toBe(line7)
expect(buffer.getLineCount()).toBe(count - 1)
xdescribe "when the line being deleted preceeds a fold, and the command is undone", ->
describe "when the line being deleted preceeds a fold, and the command is undone", ->
it "restores the line and preserves the fold", ->
editSession.setCursorBufferPosition([4])
editSession.foldCurrentRow()