mirror of
https://github.com/VSCodeVim/Vim.git
synced 2024-09-21 17:19:45 +03:00
028e9c6533
This removes a lot of code duplication, creates a better abstraction, makes testing easier, and lays the groundwork for some features like: - `:s` and similar commands working with `hlsearch` (#4934) - The expression register (#4383) - Better `incsearch` support (#4837) The central change here is to take various pieces of global state which were scattered and throughout the project and bring them together, localizing them where possible to an object (`CommandLine`) held by `VimState` (this naturally fixes #7038). This applies to both ex commands and the search command line, which means we finally have a uniform interface for them!
32 lines
939 B
TypeScript
32 lines
939 B
TypeScript
import * as assert from 'assert';
|
|
import * as vscode from 'vscode';
|
|
|
|
import { getAndUpdateModeHandler } from '../../extension';
|
|
import { ExCommandLine } from '../../src/cmd_line/commandLine';
|
|
import { ModeHandler } from '../../src/mode/modeHandler';
|
|
import { cleanUpWorkspace, setupWorkspace, WaitForEditorsToClose } from './../testUtils';
|
|
|
|
suite('Horizontal split', () => {
|
|
let modeHandler: ModeHandler;
|
|
|
|
setup(async () => {
|
|
await setupWorkspace();
|
|
modeHandler = (await getAndUpdateModeHandler())!;
|
|
});
|
|
|
|
teardown(cleanUpWorkspace);
|
|
|
|
for (const cmd of ['sp', 'split', 'new']) {
|
|
test(`:${cmd} creates a second split`, async () => {
|
|
await new ExCommandLine(cmd, modeHandler.vimState.currentMode).run(modeHandler.vimState);
|
|
await WaitForEditorsToClose(2);
|
|
|
|
assert.strictEqual(
|
|
vscode.window.visibleTextEditors.length,
|
|
2,
|
|
'Editor did not split in 1 sec'
|
|
);
|
|
});
|
|
}
|
|
});
|