@lvce-editor/test-worker 5.11.0 → 5.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +3 -1
- package/dist/testWorkerMain.js +24 -7
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -91,6 +91,8 @@ declare const growSelection: () => Promise<void>;
|
|
|
91
91
|
declare const getSelections: () => Promise<Uint32Array>;
|
|
92
92
|
declare const shouldHaveText$1: (expectedText: string) => Promise<void>;
|
|
93
93
|
declare const shouldHaveSelections: (expectedSelections: Uint32Array) => Promise<void>;
|
|
94
|
+
declare const undo: () => Promise<void>;
|
|
95
|
+
declare const redo: () => Promise<void>;
|
|
94
96
|
declare const selectIndex: (index: number) => Promise<void>;
|
|
95
97
|
declare const selectCurrentIndex: () => Promise<void>;
|
|
96
98
|
declare const handleWheel: (deltaMode: number, deltaY: number) => Promise<void>;
|
|
@@ -359,7 +361,7 @@ declare namespace Dialog {
|
|
|
359
361
|
export { executeMock, mockConfirm, mockSaveFilePicker, showSaveFilePicker };
|
|
360
362
|
}
|
|
361
363
|
declare namespace Editor {
|
|
362
|
-
export { addAllMissingImports, closeColorPicker, closeCompletion, closeCompletionDetails, copy, copyLineDown, copyLineUp, cursorCharacterLeft, cursorCharacterRight, cursorDown, cursorEnd, cursorHome, cursorUp, cursorWordLeft, cursorWordPartLeft, cursorWordPartRight, cursorWordRight, deleteAllLeft, deleteAllRight, executeTabCompletion, findAllImplementations, findAllReferences, format, getSelections, getText, goToDefinition, goToTypeDefinition, growSelection, insertLineBreak, invokeBraceCompletion, invokeTabCompletion, openColorPicker, openCompletion, openCompletionDetails, openContextMenu, openEditorContextMenu, openFind, openFindWidget, openHover, openRename, openSourceActions, organizeImports, rename, rename2, selectAll, setCursor, setDeltaY, setSelections, shouldHaveSelections, shouldHaveText$1 as shouldHaveText, showHover, sortImports, sourceActionsSelectCurrent, toggleBlockComment, toggleCompletionDetails, toggleLineComment, type };
|
|
364
|
+
export { addAllMissingImports, closeColorPicker, closeCompletion, closeCompletionDetails, copy, copyLineDown, copyLineUp, cursorCharacterLeft, cursorCharacterRight, cursorDown, cursorEnd, cursorHome, cursorUp, cursorWordLeft, cursorWordPartLeft, cursorWordPartRight, cursorWordRight, deleteAllLeft, deleteAllRight, executeTabCompletion, findAllImplementations, findAllReferences, format, getSelections, getText, goToDefinition, goToTypeDefinition, growSelection, insertLineBreak, invokeBraceCompletion, invokeTabCompletion, openColorPicker, openCompletion, openCompletionDetails, openContextMenu, openEditorContextMenu, openFind, openFindWidget, openHover, openRename, openSourceActions, organizeImports, redo, rename, rename2, selectAll, setCursor, setDeltaY, setSelections, shouldHaveSelections, shouldHaveText$1 as shouldHaveText, showHover, sortImports, sourceActionsSelectCurrent, toggleBlockComment, toggleCompletionDetails, toggleLineComment, type, undo };
|
|
363
365
|
}
|
|
364
366
|
declare namespace EditorCompletion {
|
|
365
367
|
export { handleWheel, selectCurrentIndex, selectIndex };
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -2084,22 +2084,37 @@ const getSelections = async () => {
|
|
|
2084
2084
|
// @ts-ignore
|
|
2085
2085
|
return invoke('Editor.getSelections', numeric);
|
|
2086
2086
|
};
|
|
2087
|
+
const getKey = async () => {
|
|
2088
|
+
const keys = await invoke('Editor.getKeys');
|
|
2089
|
+
if (keys.length === 0) {
|
|
2090
|
+
throw new Error(`no editor found`);
|
|
2091
|
+
}
|
|
2092
|
+
const key = keys.at(-1);
|
|
2093
|
+
const numeric = Number.parseInt(key);
|
|
2094
|
+
return numeric;
|
|
2095
|
+
};
|
|
2087
2096
|
const shouldHaveText = async expectedText => {
|
|
2088
|
-
const
|
|
2097
|
+
const key = await getKey();
|
|
2098
|
+
const text = await invoke('Editor.getText', key);
|
|
2089
2099
|
if (text !== expectedText) {
|
|
2090
2100
|
throw new Error(`Expected editor to have text ${expectedText} but was ${text}`);
|
|
2091
2101
|
}
|
|
2092
2102
|
};
|
|
2093
2103
|
const shouldHaveSelections = async expectedSelections => {
|
|
2094
|
-
const
|
|
2095
|
-
const
|
|
2096
|
-
const numeric = Number.parseInt(key);
|
|
2097
|
-
// @ts-ignore
|
|
2098
|
-
const selections = await invoke('Editor.getSelections', numeric);
|
|
2104
|
+
const key = await getKey();
|
|
2105
|
+
const selections = await invoke('Editor.getSelections', key);
|
|
2099
2106
|
if (!areSelectionsEqual(selections, expectedSelections)) {
|
|
2100
2107
|
throw new Error(`Expected editor to have selections ${expectedSelections} but was ${selections}`);
|
|
2101
2108
|
}
|
|
2102
2109
|
};
|
|
2110
|
+
const undo = async () => {
|
|
2111
|
+
// @ts-ignore
|
|
2112
|
+
await invoke('Editor.undo');
|
|
2113
|
+
};
|
|
2114
|
+
const redo = async () => {
|
|
2115
|
+
// @ts-ignore
|
|
2116
|
+
await invoke('Editor.redo');
|
|
2117
|
+
};
|
|
2103
2118
|
|
|
2104
2119
|
const TestFrameWorkComponentEditor = {
|
|
2105
2120
|
__proto__: null,
|
|
@@ -2145,6 +2160,7 @@ const TestFrameWorkComponentEditor = {
|
|
|
2145
2160
|
openRename,
|
|
2146
2161
|
openSourceActions,
|
|
2147
2162
|
organizeImports,
|
|
2163
|
+
redo,
|
|
2148
2164
|
rename: rename$1,
|
|
2149
2165
|
rename2,
|
|
2150
2166
|
selectAll: selectAll$1,
|
|
@@ -2159,7 +2175,8 @@ const TestFrameWorkComponentEditor = {
|
|
|
2159
2175
|
toggleBlockComment,
|
|
2160
2176
|
toggleCompletionDetails,
|
|
2161
2177
|
toggleLineComment,
|
|
2162
|
-
type
|
|
2178
|
+
type,
|
|
2179
|
+
undo
|
|
2163
2180
|
};
|
|
2164
2181
|
|
|
2165
2182
|
const selectIndex$6 = async index => {
|