Skip to content

Commit a497f63

Browse files
saidelikeCedric Halbronnpre-commit-ci-lite[bot]
authored
test-clipboard-cleanup (#2368)
## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [ ] I have not broken the cheatsheet This should also deprecate having to solve #559 --------- Co-authored-by: Cedric Halbronn <[email protected]> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
1 parent 2c73ca7 commit a497f63

File tree

5 files changed

+2
-15
lines changed

5 files changed

+2
-15
lines changed

packages/common/src/ide/normalized/NormalizedIDE.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { getFixturePath } from "../../index";
22
import { GeneralizedRange } from "../../types/GeneralizedRange";
33
import { TextEditor } from "../../types/TextEditor";
4-
import FakeClipboard from "../fake/FakeClipboard";
54
import FakeConfiguration from "../fake/FakeConfiguration";
65
import FakeGlobalState from "../fake/FakeGlobalState";
76
import FakeIDE from "../fake/FakeIDE";
@@ -13,7 +12,6 @@ import { QuickPickOptions } from "../types/QuickPickOptions";
1312
export class NormalizedIDE extends PassthroughIDEBase {
1413
configuration: FakeConfiguration;
1514
globalState: FakeGlobalState;
16-
clipboard: FakeClipboard;
1715

1816
constructor(
1917
original: IDE,
@@ -25,8 +23,6 @@ export class NormalizedIDE extends PassthroughIDEBase {
2523
this.messages = isSilent ? fakeIde.messages : original.messages;
2624
this.configuration = fakeIde.configuration;
2725
this.globalState = fakeIde.globalState;
28-
this.clipboard = fakeIde.clipboard;
29-
3026
this.initializeConfiguration();
3127
}
3228

packages/cursorless-engine/src/testUtil/takeSnapshot.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
Clipboard,
32
ExcludableSnapshotField,
43
ExtraContext,
54
ExtraSnapshotField,
@@ -23,7 +22,6 @@ export async function takeSnapshot(
2322
marks?: SerializedMarks,
2423
extraContext?: ExtraContext,
2524
metadata?: unknown,
26-
clipboard?: Clipboard,
2725
) {
2826
const snapshot: TestCaseSnapshot = {
2927
documentContents: editor.document.getText(),
@@ -39,7 +37,7 @@ export async function takeSnapshot(
3937
}
4038

4139
if (!excludeFields.includes("clipboard")) {
42-
snapshot.clipboard = await (clipboard ?? ide.clipboard).readText();
40+
snapshot.clipboard = await ide.clipboard.readText();
4341
}
4442

4543
if (!excludeFields.includes("visibleRanges")) {

packages/cursorless-vscode-e2e/src/suite/recorded.vscode.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ async function runTest(file: string, spyIde: SpyIDE) {
9999
}
100100

101101
if (fixture.initialState.clipboard) {
102-
vscode.env.clipboard.writeText(fixture.initialState.clipboard);
103-
// FIXME https://github.com/cursorless-dev/cursorless/issues/559
104-
// spyIde.clipboard.writeText(fixture.initialState.clipboard);
102+
spyIde.clipboard.writeText(fixture.initialState.clipboard);
105103
}
106104

107105
commandServerApi.setFocusedElementType(fixture.focusedElementType);
@@ -188,8 +186,6 @@ async function runTest(file: string, spyIde: SpyIDE) {
188186
spyIde.activeTextEditor!,
189187
spyIde,
190188
marks,
191-
// FIXME: Stop overriding the clipboard once we have #559
192-
true,
193189
);
194190

195191
const rawSpyIdeValues = spyIde.getSpyValues(fixture.ide?.flashes != null);

packages/cursorless-vscode/src/constructTestHelpers.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export function constructTestHelpers(
5151
editor: TextEditor,
5252
ide: IDE,
5353
marks: SerializedMarks | undefined,
54-
forceRealClipboard: boolean,
5554
): Promise<TestCaseSnapshot> {
5655
return takeSnapshot(
5756
storedTargets,
@@ -62,7 +61,6 @@ export function constructTestHelpers(
6261
marks,
6362
undefined,
6463
undefined,
65-
forceRealClipboard ? vscodeIDE.clipboard : undefined,
6664
);
6765
},
6866

packages/vscode-common/src/TestHelpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export interface TestHelpers {
4040
editor: TextEditor,
4141
ide: IDE,
4242
marks: SerializedMarks | undefined,
43-
forceRealClipboard: boolean,
4443
): Promise<TestCaseSnapshot>;
4544

4645
runIntegrationTests(): Promise<void>;

0 commit comments

Comments
 (0)