Tab stops are associated with anchors so we can jump to them event when the buffer changes

This commit is contained in:
Nathan Sobo
2012-06-22 12:07:20 -06:00
parent ae2b686802
commit 5c6e94ec74
4 changed files with 23 additions and 7 deletions

View File

@@ -47,8 +47,13 @@ describe "Snippets extension", ->
expect(buffer.lineForRow(1)).toBe "go here first:()"
expect(buffer.lineForRow(2)).toBe "var quicksort = function () {"
expect(editor.getCursorScreenPosition()).toEqual [1, 15]
editor.trigger keydownEvent('tab', target: editor[0])
expect(editor.getCursorScreenPosition()).toEqual [0, 14]
editor.insertText 'abc'
editor.trigger keydownEvent('tab', target: editor[0])
expect(editor.getCursorScreenPosition()).toEqual [0, 40]
describe "when the letters preceding the cursor don't match a snippet", ->
it "inserts a tab as normal", ->
@@ -108,7 +113,7 @@ describe "Snippets extension", ->
snippet = snippets['t1']
expect(snippet.body).toBe """
go here next:() and finally go here:()
go here first:()\n
go here first:()
"""
expect(snippet.tabStops).toEqual [[1, 15], [0, 14], [0, 37]]