@@ -589,37 +589,40 @@ describe "Snippets extension", ->
589589 expect (editor .getSelectedBufferRange ()).toEqual [[0 , 0 ], [0 , 4 ]]
590590
591591 describe " when a previous snippet expansion has just been undone" , ->
592- it " expands the snippet based on the current prefix rather than jumping to the old snippet's tab stop" , ->
593- editor .insertText ' t6\n '
594- editor .setCursorBufferPosition [0 , 2 ]
595- simulateTabKeyEvent ()
596- expect (editor .lineTextForBufferRow (0 )).toBe " first line"
597- editor .undo ()
598- expect (editor .lineTextForBufferRow (0 )).toBe " t6"
599- simulateTabKeyEvent ()
600- expect (editor .lineTextForBufferRow (0 )).toBe " first line"
592+ describe " when the tab stops appear in the middle of the snippet" , ->
593+ it " expands the snippet based on the current prefix rather than jumping to the old snippet's tab stop" , ->
594+ editor .insertText ' t6\n '
595+ editor .setCursorBufferPosition [0 , 2 ]
596+ simulateTabKeyEvent ()
597+ expect (editor .lineTextForBufferRow (0 )).toBe " first line"
598+ editor .undo ()
599+ expect (editor .lineTextForBufferRow (0 )).toBe " t6"
600+ simulateTabKeyEvent ()
601+ expect (editor .lineTextForBufferRow (0 )).toBe " first line"
601602
602- it " does not remember the tab stops when the whole snippet has been undone (regression)" , ->
603- editor .insertText ' t6b\n '
604- editor .setCursorBufferPosition [0 , 3 ]
605- simulateTabKeyEvent ()
606- expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
607- editor .undo ()
608- expect (editor .lineTextForBufferRow (0 )).toBe " t6b"
609- simulateTabKeyEvent ()
610- expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
611- expect (editor .getCursorBufferPosition ()).toEqual ([0 , 0 ])
603+ describe " when the tab stops appear at the beginning and then the end of snippet" , ->
604+ it " expands the snippet based on the current prefix rather than jumping to the old snippet's tab stop" , ->
605+ editor .insertText ' t6b\n '
606+ editor .setCursorBufferPosition [0 , 3 ]
607+ simulateTabKeyEvent ()
608+ expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
609+ editor .undo ()
610+ expect (editor .lineTextForBufferRow (0 )).toBe " t6b"
611+ simulateTabKeyEvent ()
612+ expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
613+ expect (editor .getCursorBufferPosition ()).toEqual ([0 , 0 ])
612614
613- it " does not remember the tab stops when the whole snippet has been undone (regression, alternative version)" , ->
614- editor .insertText ' t6c\n '
615- editor .setCursorBufferPosition [0 , 3 ]
616- simulateTabKeyEvent ()
617- expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
618- editor .undo ()
619- expect (editor .lineTextForBufferRow (0 )).toBe " t6c"
620- simulateTabKeyEvent ()
621- expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
622- expect (editor .getCursorBufferPosition ()).toEqual ([0 , 8 ])
615+ describe " when the tab stops appear at the end and then the beginning of snippet" , ->
616+ it " expands the snippet based on the current prefix rather than jumping to the old snippet's tab stop" , ->
617+ editor .insertText ' t6c\n '
618+ editor .setCursorBufferPosition [0 , 3 ]
619+ simulateTabKeyEvent ()
620+ expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
621+ editor .undo ()
622+ expect (editor .lineTextForBufferRow (0 )).toBe " t6c"
623+ simulateTabKeyEvent ()
624+ expect (editor .lineTextForBufferRow (0 )).toBe " expanded"
625+ expect (editor .getCursorBufferPosition ()).toEqual ([0 , 8 ])
623626
624627 describe " when the prefix contains non-word characters" , ->
625628 it " selects the non-word characters as part of the prefix" , ->
0 commit comments