From 55404c21517b2f1ae6f15c5a80a78051a36b75fb Mon Sep 17 00:00:00 2001 From: Indrek Ardel Date: Fri, 15 Nov 2019 00:11:59 +0200 Subject: [PATCH] Decouple core indentation logic from spec --- spec/snippets-spec.coffee | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/snippets-spec.coffee b/spec/snippets-spec.coffee index dd00a5d..38e7254 100644 --- a/spec/snippets-spec.coffee +++ b/spec/snippets-spec.coffee @@ -583,14 +583,16 @@ describe "Snippets extension", -> expect(editor.lineTextForBufferRow(0)).toBe "xxte var quicksort = function () {" expect(editor.getCursorScreenPosition()).toEqual [0, 6] - describe "when text is selected", -> - it "inserts a tab as normal", -> + describe "when a snippet matching prefix is selected", -> + it "does not expand the snippet", -> editor.insertText("t1") editor.setSelectedBufferRange([[0, 0], [0, 2]]) + originalLine = editor.lineTextForBufferRow(0) simulateTabKeyEvent() - expect(editor.lineTextForBufferRow(0)).toBe " t1var quicksort = function () {" - expect(editor.getSelectedBufferRange()).toEqual [[0, 0], [0, 4]] + expect(editor.lineTextForBufferRow(0)).not.toEqual originalLine + expect(editor.lineTextForBufferRow(0)).toContain "var quicksort = function () {" + expect(editor.lineTextForBufferRow(0)).not.toContain "this is a test" describe "when a previous snippet expansion has just been undone", -> describe "when the tab stops appear in the middle of the snippet", ->