@lvce-editor/test-worker 5.2.0 → 5.4.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 CHANGED
@@ -19,7 +19,7 @@ declare const readNativeFiles: () => Promise<void>;
19
19
  declare const writeNativeFiles: (uris: readonly string[]) => Promise<void>;
20
20
  declare const enableMemoryClipBoard: () => Promise<void>;
21
21
  declare const disableMemoryClipBoard: () => Promise<void>;
22
- declare const shouldHaveText: (expectedText: string) => Promise<void>;
22
+ declare const shouldHaveText: (expectedText: string | RegExp) => Promise<void>;
23
23
  declare const execute: (id: string, ...args: readonly any[]) => Promise<any>;
24
24
  declare const selectItem: (text: string) => Promise<void>;
25
25
  declare const openIframeInspector: () => Promise<void>;
@@ -32,7 +32,8 @@ declare const reloadIconTheme: () => Promise<void>;
32
32
  declare const toggleDeveloperTools: () => Promise<void>;
33
33
  declare const showSaveFilePicker: () => Promise<void>;
34
34
  declare const mockSaveFilePicker: (fn: () => string) => Promise<void>;
35
- declare const executeMock: (id: number) => string;
35
+ declare const mockConfirm: (fn: () => boolean) => Promise<void>;
36
+ declare const executeMock: (id: number, ...args: readonly any[]) => string;
36
37
  declare const setCursor: (rowIndex: number, columnIndex: number) => Promise<void>;
37
38
  declare const openCompletion: () => Promise<void>;
38
39
  declare const closeCompletion: () => Promise<void>;
@@ -236,6 +237,9 @@ declare const selectItem$1: (label: string) => Promise<void>;
236
237
  declare const selectIndex$3: (index: number) => Promise<void>;
237
238
  declare const selectCurrentIndex$2: () => Promise<void>;
238
239
  declare const executeCommand: (label: string) => Promise<void>;
240
+ declare const clear$1: () => Promise<void>;
241
+ declare const collapseAll: () => Promise<void>;
242
+ declare const refresh$1: () => Promise<void>;
239
243
  declare const handleClickSectionWatch: () => Promise<void>;
240
244
  declare const addWatchExpression: (expression: string) => Promise<void>;
241
245
  declare const handleWatchValueChange: () => Promise<void>;
@@ -272,7 +276,7 @@ declare const show$3: () => Promise<void>;
272
276
  declare const handleInput$2: (searchValue: string) => Promise<void>;
273
277
  declare const usePreviousSearchValue: () => Promise<void>;
274
278
  declare const useNextSearchValue: () => Promise<void>;
275
- declare const clear$1: (searchValue: string) => Promise<void>;
279
+ declare const clear$2: (searchValue: string) => Promise<void>;
276
280
  declare const selectTab$1: (tabId: string) => Promise<void>;
277
281
  declare const selectWorkspace: () => Promise<void>;
278
282
  declare const selectTextEditor: () => Promise<void>;
@@ -333,7 +337,7 @@ declare namespace Developer {
333
337
  export { openCacheFolder, openConfigFolder, openIframeInspector, openLogsFolder, openProcessExplorer, reloadColorTheme, reloadIconTheme, toggleDeveloperTools };
334
338
  }
335
339
  declare namespace Dialog {
336
- export { executeMock, mockSaveFilePicker, showSaveFilePicker };
340
+ export { executeMock, mockConfirm, mockSaveFilePicker, showSaveFilePicker };
337
341
  }
338
342
  declare namespace Editor {
339
343
  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 };
@@ -389,6 +393,9 @@ declare namespace Problems {
389
393
  declare namespace QuickPick {
390
394
  export { executeCommand, focusFirst$5 as focusFirst, focusIndex$3 as focusIndex, focusLast$5 as focusLast, focusNext$7 as focusNext, focusPrevious$5 as focusPrevious, handleClickAt$2 as handleClickAt, handleInput$1 as handleInput, open$3 as open, selectCurrentIndex$2 as selectCurrentIndex, selectIndex$3 as selectIndex, selectItem$1 as selectItem, setValue$1 as setValue };
391
395
  }
396
+ declare namespace References {
397
+ export { clear$1 as clear, collapseAll, refresh$1 as refresh };
398
+ }
392
399
  declare namespace RunAndDebug {
393
400
  export { acceptWatchExpressionEdit, addWatchExpression, handleClickSectionWatch, handleRename, handleSpace, handleWatchValueChange, selectIndex$4 as selectIndex, setPauseOnExceptions };
394
401
  }
@@ -399,7 +406,7 @@ declare namespace Settings {
399
406
  export { update };
400
407
  }
401
408
  declare namespace SettingsView {
402
- export { clear$1 as clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$3 as show, useNextSearchValue, usePreviousSearchValue };
409
+ export { clear$2 as clear, handleInput$2 as handleInput, handleScroll$1 as handleScroll, selectExtensions, selectTab$1 as selectTab, selectTextEditor, selectWorkspace, show$3 as show, useNextSearchValue, usePreviousSearchValue };
403
410
  }
404
411
  declare namespace SideBar {
405
412
  export { hide, open$4 as open };
@@ -447,6 +454,7 @@ export interface TestApi {
447
454
  readonly Platform: typeof Platform,
448
455
  readonly Problems: typeof Problems,
449
456
  readonly QuickPick: typeof QuickPick,
457
+ readonly References: typeof References,
450
458
  readonly RunAndDebug: typeof RunAndDebug,
451
459
  readonly Search: typeof Search,
452
460
  readonly Settings: typeof Settings,
@@ -1736,10 +1736,16 @@ const disableMemoryClipBoard = async () => {
1736
1736
  // @ts-ignore
1737
1737
  await invoke$1('ClipBoard.disableMemoryClipBoard');
1738
1738
  };
1739
+ const matchesExpectedText = (actualText, expectedText) => {
1740
+ if (typeof expectedText === 'string') {
1741
+ return actualText === expectedText;
1742
+ }
1743
+ return expectedText.test(actualText);
1744
+ };
1739
1745
  const shouldHaveText$1 = async expectedText => {
1740
1746
  // @ts-ignore
1741
1747
  const actualText = await invoke$1('ClipBoard.readMemoryText');
1742
- if (actualText !== expectedText) {
1748
+ if (!matchesExpectedText(actualText, expectedText)) {
1743
1749
  throw new AssertionError(`expected clipboard to have text "${expectedText}" but was "${actualText}"`);
1744
1750
  }
1745
1751
  };
@@ -1827,9 +1833,9 @@ const registerMock = fn => {
1827
1833
  mocks[id] = fn;
1828
1834
  return id;
1829
1835
  };
1830
- const executeMock$1 = id => {
1836
+ const executeMock$1 = (id, ...args) => {
1831
1837
  const fn = mocks[id];
1832
- return fn();
1838
+ return fn(...args);
1833
1839
  };
1834
1840
 
1835
1841
  const showSaveFilePicker = async () => {
@@ -1841,13 +1847,19 @@ const mockSaveFilePicker = async fn => {
1841
1847
  // @ts-ignore
1842
1848
  await invoke$1('FilePicker.mockSaveFilePicker', id);
1843
1849
  };
1844
- const executeMock = id => {
1845
- return executeMock$1(id);
1850
+ const mockConfirm = async fn => {
1851
+ const id = registerMock(fn);
1852
+ // @ts-ignore
1853
+ await invoke$1('ConfirmPrompt.mock', id);
1854
+ };
1855
+ const executeMock = (id, ...args) => {
1856
+ return executeMock$1(id, ...args);
1846
1857
  };
1847
1858
 
1848
1859
  const TestFrameWorkComponentDialog = {
1849
1860
  __proto__: null,
1850
1861
  executeMock,
1862
+ mockConfirm,
1851
1863
  mockSaveFilePicker,
1852
1864
  showSaveFilePicker
1853
1865
  };
@@ -2073,7 +2085,7 @@ const getSelections = async () => {
2073
2085
  return invoke('Editor.getSelections', numeric);
2074
2086
  };
2075
2087
  const shouldHaveText = async expectedText => {
2076
- const text = await invoke$1('Editor.getText');
2088
+ const text = await invoke('Editor.getText');
2077
2089
  if (text !== expectedText) {
2078
2090
  throw new Error(`Expected editor to have text ${expectedText} but was ${text}`);
2079
2091
  }
@@ -2214,7 +2226,7 @@ const handleDragOverIndex = async index => {
2214
2226
  const selectDown = async () => {
2215
2227
  await invoke$1('Explorer.selectDown');
2216
2228
  };
2217
- const refresh = async () => {
2229
+ const refresh$1 = async () => {
2218
2230
  await invoke$1('Explorer.refresh');
2219
2231
  };
2220
2232
  const focusIndex$5 = async index => {
@@ -2326,7 +2338,7 @@ const TestFrameWorkComponentExplorer = {
2326
2338
  newFile,
2327
2339
  newFolder,
2328
2340
  openContextMenu,
2329
- refresh,
2341
+ refresh: refresh$1,
2330
2342
  removeDirent,
2331
2343
  rename,
2332
2344
  renameDirent,
@@ -2788,14 +2800,14 @@ const selectChannel = async channelId => {
2788
2800
  // @ts-ignore
2789
2801
  await invoke$1('Output.selectChannel', channelId);
2790
2802
  };
2791
- const clear$1 = async () => {
2803
+ const clear$2 = async () => {
2792
2804
  // @ts-ignore
2793
2805
  await invoke$1('Output.clear');
2794
2806
  };
2795
2807
 
2796
2808
  const TestFrameWorkComponentOutput = {
2797
2809
  __proto__: null,
2798
- clear: clear$1,
2810
+ clear: clear$2,
2799
2811
  handleFilterInput: handleFilterInput$1,
2800
2812
  selectChannel,
2801
2813
  show: show$2
@@ -2983,6 +2995,26 @@ const TestFrameWorkComponentQuickPick = {
2983
2995
  setValue: setValue$1
2984
2996
  };
2985
2997
 
2998
+ const clear$1 = async () => {
2999
+ // @ts-ignore
3000
+ return invoke$1('References.clear');
3001
+ };
3002
+ const collapseAll = async () => {
3003
+ // @ts-ignore
3004
+ return invoke$1('References.collapseAll');
3005
+ };
3006
+ const refresh = async () => {
3007
+ // @ts-ignore
3008
+ return invoke$1('References.refresh');
3009
+ };
3010
+
3011
+ const TestFrameWorkComponentReferences = {
3012
+ __proto__: null,
3013
+ clear: clear$1,
3014
+ collapseAll,
3015
+ refresh
3016
+ };
3017
+
2986
3018
  const handleClickSectionWatch = async () => {
2987
3019
  // @ts-ignore
2988
3020
  await invoke$1('Run And Debug.handleClickSectionWatch');
@@ -3438,6 +3470,7 @@ const TestFrameWorkComponent = {
3438
3470
  Platform: TestFrameWorkComponentPlatform,
3439
3471
  Problems: TestFrameWorkComponentProblems,
3440
3472
  QuickPick: TestFrameWorkComponentQuickPick,
3473
+ References: TestFrameWorkComponentReferences,
3441
3474
  RunAndDebug: TestFrameWorkComponentRunAndDebug,
3442
3475
  Search: TestFrameWorkComponentSearch,
3443
3476
  Settings: TestFrameWorkComponentSettings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",