Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 8c8a627

Browse files
committed
unit tests
1 parent ed0cf7e commit 8c8a627

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

test/spec/EditorCommandHandlers-test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ define(function (require, exports, module) {
4747
"\n" +
4848
"}";
4949

50+
var tabbedContent = "function funcWithTabs() {\n" +
51+
" var i = 0;\n" +
52+
" var offset = 0;\n" +
53+
"}";
54+
5055
var myDocument, myEditor;
5156

5257
var testPath = SpecRunnerUtils.getTestPath("/spec/EditorCommandHandlers-test-files"),
@@ -3316,6 +3321,26 @@ define(function (require, exports, module) {
33163321

33173322
});
33183323

3324+
describe("Add Line to Selection with Tabs", function () {
3325+
beforeEach(function () {
3326+
setupFullEditor(tabbedContent);
3327+
});
3328+
3329+
it("should add a cursor on the next line before a single cursor in same visual position", function () {
3330+
myEditor.setSelection({line: 1, ch: 8}, {line: 1, ch: 8});
3331+
CommandManager.execute(Commands.EDIT_ADD_NEXT_LINE_TO_SEL, myEditor);
3332+
expectSelections([{start: {line: 1, ch: 8}, end: {line: 1, ch: 8}, primary: false, reversed: false},
3333+
{start: {line: 2, ch: 12}, end: {line: 2, ch: 12}, primary: true, reversed: false}]);
3334+
});
3335+
3336+
it("should add a cursor on the previous line before a single cursor selection in same visual position", function () {
3337+
myEditor.setSelection({line: 2, ch: 12}, {line: 2, ch: 12});
3338+
CommandManager.execute(Commands.EDIT_ADD_PREV_LINE_TO_SEL, myEditor);
3339+
expectSelections([{start: {line: 1, ch: 8}, end: {line: 1, ch: 8}, primary: true, reversed: false},
3340+
{start: {line: 2, ch: 12}, end: {line: 2, ch: 12}, primary: false, reversed: false}]);
3341+
});
3342+
});
3343+
33193344
describe("EditorCommandHandlers Integration", function () {
33203345
this.category = "integration";
33213346

0 commit comments

Comments
 (0)