-
-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathcrossCellsSetSelection.vscode.test.ts
More file actions
54 lines (44 loc) · 1.32 KB
/
Copy pathcrossCellsSetSelection.vscode.test.ts
File metadata and controls
54 lines (44 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { isLinux } from "@cursorless/node-common";
import {
getCursorlessApi,
openNewNotebookEditor,
runCursorlessCommand,
} from "@cursorless/vscode-common";
import assert from "assert";
import { window } from "vscode";
import { endToEndTestSetup } from "../endToEndTestSetup";
import { isCI } from "../isCI";
// Check that setSelection is able to focus the correct cell
suite("Cross-cell set selection", async function () {
// FIXME: This test is flaky on Linux CI, so we skip it there for now
if (isCI() && isLinux()) {
this.ctx.skip();
}
endToEndTestSetup(this);
test("Cross-cell set selection", runTest);
});
async function runTest() {
const { hatTokenMap } = (await getCursorlessApi()).testHelpers!;
await openNewNotebookEditor(['"hello"', '"world"']);
await hatTokenMap.allocateHats();
await runCursorlessCommand({
version: 1,
action: "setSelection",
targets: [
{
type: "primitive",
mark: {
type: "decoratedSymbol",
symbolColor: "default",
character: "o",
},
},
],
});
// eslint-disable-next-line no-restricted-properties
const editor = window.activeTextEditor;
if (editor == null) {
assert(false, "No editor was focused");
}
assert.deepStrictEqual(editor.document.getText(editor.selection), "world");
}