mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-27 23:30:30 -04:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { MoveCaretCommand } from 'vs/editor/contrib/caretOperations/common/moveCaretCommand';
|
||||
import { testCommand } from 'vs/editor/test/common/commands/commandTestUtils';
|
||||
|
||||
|
||||
function testMoveCaretLeftCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void {
|
||||
testCommand(lines, null, selection, (sel) => new MoveCaretCommand(sel, true), expectedLines, expectedSelection);
|
||||
}
|
||||
|
||||
function testMoveCaretRightCommand(lines: string[], selection: Selection, expectedLines: string[], expectedSelection: Selection): void {
|
||||
testCommand(lines, null, selection, (sel) => new MoveCaretCommand(sel, false), expectedLines, expectedSelection);
|
||||
}
|
||||
|
||||
suite('Editor Contrib - Move Caret Command', () => {
|
||||
|
||||
test('move selection to left', function () {
|
||||
testMoveCaretLeftCommand(
|
||||
[
|
||||
'012345'
|
||||
],
|
||||
new Selection(1, 3, 1, 5),
|
||||
[
|
||||
'023145'
|
||||
],
|
||||
new Selection(1, 2, 1, 4)
|
||||
);
|
||||
});
|
||||
test('move selection to right', function () {
|
||||
testMoveCaretRightCommand(
|
||||
[
|
||||
'012345'
|
||||
],
|
||||
new Selection(1, 3, 1, 5),
|
||||
[
|
||||
'014235'
|
||||
],
|
||||
new Selection(1, 4, 1, 6)
|
||||
);
|
||||
});
|
||||
test('move selection to left - from first column - no change', function () {
|
||||
testMoveCaretLeftCommand(
|
||||
[
|
||||
'012345'
|
||||
],
|
||||
new Selection(1, 1, 1, 1),
|
||||
[
|
||||
'012345'
|
||||
],
|
||||
new Selection(1, 1, 1, 1)
|
||||
);
|
||||
});
|
||||
test('move selection to right - from last column - no change', function () {
|
||||
testMoveCaretRightCommand(
|
||||
[
|
||||
'012345'
|
||||
],
|
||||
new Selection(1, 5, 1, 7),
|
||||
[
|
||||
'012345'
|
||||
],
|
||||
new Selection(1, 5, 1, 7)
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user