Add failing spec demonstrating inability to undo snippet expansion

This commit is contained in:
Nathan Sobo
2012-07-05 16:41:37 -06:00
parent 569359b687
commit d53be3b28d

View File

@@ -41,6 +41,11 @@ describe "Snippets extension", ->
go here ${1:first} and then here ${2:second}
endsnippet
snippet t5 "Caused problems with undo"
first line $1
${2:placeholder ending second line}
endsnippet
"""
describe "when the letters preceding the cursor trigger a snippet", ->
@@ -144,6 +149,18 @@ describe "Snippets extension", ->
expect(buffer.lineForRow(0)).toBe "xte var quicksort = function () {"
expect(editor.getCursorScreenPosition()).toEqual [0, 5]
describe "when a previous snippet expansion has just been undone", ->
fit "expands the snippet based on the current prefix rather than jumping to the old snippet's tab stop", ->
editor.insertText 't5\n'
editor.setCursorBufferPosition [0, 2]
editor.trigger keydownEvent('tab', target: editor[0])
expect(buffer.lineForRow(0)).toBe "first line"
editor.undo()
editor.undo()
expect(buffer.lineForRow(0)).toBe "t5"
editor.trigger keydownEvent('tab', target: editor[0])
expect(buffer.lineForRow(0)).toBe "first line"
describe ".loadSnippetsFile(path)", ->
it "loads the snippets in the given file", ->
spyOn(fs, 'read').andReturn """