From df68ae26a2cf7e623730e5d0793e4758bf25bfef Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 17 Sep 2014 09:30:26 -0700 Subject: [PATCH] Add specs for variation sequences --- spec/editor-spec.coffee | 43 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee index 6ff0aa304..c43b2bae8 100644 --- a/spec/editor-spec.coffee +++ b/spec/editor-spec.coffee @@ -3343,7 +3343,7 @@ describe "Editor", -> editor2.destroy() expect(editor.shouldPromptToSave()).toBeTruthy() - describe "when the edit session contains surrogate pair characters", -> + describe "when the editor text contains surrogate pair characters", -> it "correctly backspaces over them", -> editor.setText('\uD835\uDF97\uD835\uDF97\uD835\uDF97') editor.moveToBottom() @@ -3384,6 +3384,47 @@ describe "Editor", -> editor.moveLeft() expect(editor.getCursorBufferPosition()).toEqual [0, 0] + describe "when the editor contains variation sequence character pairs", -> + it "correctly backspaces over them", -> + editor.setText('\u2714\uFE0E\u2714\uFE0E\u2714\uFE0E') + editor.moveToBottom() + editor.backspace() + expect(editor.getText()).toBe '\u2714\uFE0E\u2714\uFE0E' + editor.backspace() + expect(editor.getText()).toBe '\u2714\uFE0E' + editor.backspace() + expect(editor.getText()).toBe '' + + it "correctly deletes over them", -> + editor.setText('\u2714\uFE0E\u2714\uFE0E\u2714\uFE0E') + editor.moveToTop() + editor.delete() + expect(editor.getText()).toBe '\u2714\uFE0E\u2714\uFE0E' + editor.delete() + expect(editor.getText()).toBe '\u2714\uFE0E' + editor.delete() + expect(editor.getText()).toBe '' + + it "correctly moves over them", -> + editor.setText('\u2714\uFE0E\u2714\uFE0E\u2714\uFE0E\n') + editor.moveToTop() + editor.moveRight() + expect(editor.getCursorBufferPosition()).toEqual [0, 2] + editor.moveRight() + expect(editor.getCursorBufferPosition()).toEqual [0, 4] + editor.moveRight() + expect(editor.getCursorBufferPosition()).toEqual [0, 6] + editor.moveRight() + expect(editor.getCursorBufferPosition()).toEqual [1, 0] + editor.moveLeft() + expect(editor.getCursorBufferPosition()).toEqual [0, 6] + editor.moveLeft() + expect(editor.getCursorBufferPosition()).toEqual [0, 4] + editor.moveLeft() + expect(editor.getCursorBufferPosition()).toEqual [0, 2] + editor.moveLeft() + expect(editor.getCursorBufferPosition()).toEqual [0, 0] + describe ".setIndentationForBufferRow", -> describe "when the editor uses soft tabs but the row has hard tabs", -> it "only replaces whitespace characters", ->