diff --git a/packages/editor/tests/unit/fields/CodeSelectCol.spec.ts b/packages/editor/tests/unit/fields/CodeSelectCol.spec.ts index c82364dd..ee68234e 100644 --- a/packages/editor/tests/unit/fields/CodeSelectCol.spec.ts +++ b/packages/editor/tests/unit/fields/CodeSelectCol.spec.ts @@ -24,11 +24,6 @@ vi.mock('@editor/hooks/use-services', () => ({ useServices: () => ({ codeBlockService, uiService }), })); -vi.mock('@editor/type', async () => { - const actual = await vi.importActual('@editor/type'); - return { ...actual, SideItemKey: { CODE_BLOCK: 'code-block' } }; -}); - vi.mock('@tmagic/form', async (importOriginal) => { const actual = await importOriginal(); return { diff --git a/packages/editor/tests/unit/fields/DataSourceInput.spec.ts b/packages/editor/tests/unit/fields/DataSourceInput.spec.ts index 926e973b..ae2736a8 100644 --- a/packages/editor/tests/unit/fields/DataSourceInput.spec.ts +++ b/packages/editor/tests/unit/fields/DataSourceInput.spec.ts @@ -115,15 +115,6 @@ vi.mock('@tmagic/design', async () => { }; }); -vi.mock('@tmagic/utils', async () => { - const actual = await vi.importActual('@tmagic/utils'); - return { - ...actual, - getKeysArray: vi.fn((s: string) => s.split('.').filter(Boolean)), - isNumber: (v: any) => /^\d+$/.test(String(v)), - }; -}); - beforeEach(() => { vi.clearAllMocks(); inputRef.input = null; diff --git a/packages/editor/tests/unit/fields/DataSourceMethodSelect.spec.ts b/packages/editor/tests/unit/fields/DataSourceMethodSelect.spec.ts index 0c02a7ac..2395ad35 100644 --- a/packages/editor/tests/unit/fields/DataSourceMethodSelect.spec.ts +++ b/packages/editor/tests/unit/fields/DataSourceMethodSelect.spec.ts @@ -33,11 +33,6 @@ vi.mock('@editor/utils', async () => { return { ...actual, getFieldType: vi.fn(() => 'string') }; }); -vi.mock('@editor/type', async () => { - const actual = await vi.importActual('@editor/type'); - return { ...actual, SideItemKey: { DATA_SOURCE: 'data-source' } }; -}); - vi.mock('@tmagic/utils', async () => { const actual = await vi.importActual('@tmagic/utils'); return { ...actual, DATA_SOURCE_SET_DATA_METHOD_NAME: '__set_data__' }; diff --git a/packages/editor/tests/unit/fields/DataSourceSelect.spec.ts b/packages/editor/tests/unit/fields/DataSourceSelect.spec.ts index 27f636c9..93b0be0d 100644 --- a/packages/editor/tests/unit/fields/DataSourceSelect.spec.ts +++ b/packages/editor/tests/unit/fields/DataSourceSelect.spec.ts @@ -21,11 +21,6 @@ vi.mock('@editor/hooks/use-services', () => ({ useServices: () => ({ dataSourceService, uiService }), })); -vi.mock('@editor/type', async () => { - const actual = await vi.importActual('@editor/type'); - return { ...actual, SideItemKey: { DATA_SOURCE: 'data-source' } }; -}); - vi.mock('@tmagic/form', async (importOriginal) => { const actual = await importOriginal(); return { diff --git a/packages/editor/tests/unit/fields/EventSelect.spec.ts b/packages/editor/tests/unit/fields/EventSelect.spec.ts index 14fa9145..8dedef6a 100644 --- a/packages/editor/tests/unit/fields/EventSelect.spec.ts +++ b/packages/editor/tests/unit/fields/EventSelect.spec.ts @@ -96,10 +96,6 @@ vi.mock('@tmagic/utils', async () => { return { ...actual, DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX: 'ds_change_', - traverseNode: (node: any, fn: any) => { - fn(node); - node.items?.forEach((c: any) => fn(c)); - }, }; }); diff --git a/packages/editor/tests/unit/fields/PageFragmentSelect.spec.ts b/packages/editor/tests/unit/fields/PageFragmentSelect.spec.ts index 1b4e5b99..0259f48a 100644 --- a/packages/editor/tests/unit/fields/PageFragmentSelect.spec.ts +++ b/packages/editor/tests/unit/fields/PageFragmentSelect.spec.ts @@ -44,11 +44,6 @@ vi.mock('@editor/components/Icon.vue', () => ({ }), })); -vi.mock('@tmagic/core', async () => { - const actual = await vi.importActual('@tmagic/core'); - return { ...actual, NodeType: { PAGE: 'page', PAGE_FRAGMENT: 'page-fragment' } }; -}); - describe('PageFragmentSelect', () => { test('model[name] 不为空时显示编辑图标', () => { editorService.get.mockReturnValue({ items: [{ id: 'p1', type: 'page-fragment', name: 'A' }] }); diff --git a/packages/editor/tests/unit/fields/UISelect.spec.ts b/packages/editor/tests/unit/fields/UISelect.spec.ts index 0226b553..9f833a64 100644 --- a/packages/editor/tests/unit/fields/UISelect.spec.ts +++ b/packages/editor/tests/unit/fields/UISelect.spec.ts @@ -27,11 +27,6 @@ vi.mock('@editor/hooks/use-services', () => ({ useServices: () => ({ editorService, uiService, stageOverlayService }), })); -vi.mock('@tmagic/utils', async () => { - const actual = await vi.importActual('@tmagic/utils'); - return { ...actual, getIdFromEl: () => (el: any) => el?.dataset?.tmagicId }; -}); - vi.mock('@tmagic/design', () => ({ TMagicButton: defineComponent({ name: 'TMagicButton', diff --git a/packages/editor/tests/unit/initService.spec.ts b/packages/editor/tests/unit/initService.spec.ts index 91a66950..77de5d14 100644 --- a/packages/editor/tests/unit/initService.spec.ts +++ b/packages/editor/tests/unit/initService.spec.ts @@ -144,7 +144,6 @@ vi.mock('@tmagic/utils', async () => { ...actual, getDepNodeIds: vi.fn(() => []), getNodes: vi.fn(() => []), - isValueIncludeDataSource: vi.fn((v: any) => /\$\{/.test(String(v))), }; }); diff --git a/packages/editor/tests/unit/layouts/AddPageBox.spec.ts b/packages/editor/tests/unit/layouts/AddPageBox.spec.ts index eb08dfcc..3e3ee4b0 100644 --- a/packages/editor/tests/unit/layouts/AddPageBox.spec.ts +++ b/packages/editor/tests/unit/layouts/AddPageBox.spec.ts @@ -8,14 +8,6 @@ import { mount } from '@vue/test-utils'; import AddPageBox from '@editor/layouts/AddPageBox.vue'; -vi.mock('@tmagic/core', async () => { - const actual = await vi.importActual('@tmagic/core'); - return { - ...actual, - NodeType: { PAGE: 'page', PAGE_FRAGMENT: 'page-fragment' }, - }; -}); - const editorService = { get: vi.fn((key: string) => (key === 'root' ? { items: [] } : undefined)), add: vi.fn(), diff --git a/packages/editor/tests/unit/layouts/NavMenu.spec.ts b/packages/editor/tests/unit/layouts/NavMenu.spec.ts index 44e9f825..24d7dc74 100644 --- a/packages/editor/tests/unit/layouts/NavMenu.spec.ts +++ b/packages/editor/tests/unit/layouts/NavMenu.spec.ts @@ -48,11 +48,6 @@ vi.mock('@editor/components/ToolButton.vue', () => ({ }), })); -vi.mock('@editor/type', async () => { - const actual = await vi.importActual('@editor/type'); - return { ...actual, ColumnLayout: { LEFT: 'left', CENTER: 'center', RIGHT: 'right' } }; -}); - class FakeResizeObserver { cb: any; constructor(cb: any) { diff --git a/packages/editor/tests/unit/layouts/sidebar/Sidebar.spec.ts b/packages/editor/tests/unit/layouts/sidebar/Sidebar.spec.ts index a7b6c997..b847c274 100644 --- a/packages/editor/tests/unit/layouts/sidebar/Sidebar.spec.ts +++ b/packages/editor/tests/unit/layouts/sidebar/Sidebar.spec.ts @@ -82,20 +82,6 @@ vi.mock('@editor/components/FloatingBox.vue', () => ({ }), })); -vi.mock('@editor/type', async () => { - const actual = await vi.importActual('@editor/type'); - return { - ...actual, - SideItemKey: { - COMPONENT_LIST: 'component-list', - LAYER: 'layer', - CODE_BLOCK: 'code-block', - DATA_SOURCE: 'data-source', - }, - ColumnLayout: { LEFT: 'left', CENTER: 'center', RIGHT: 'right' }, - }; -}); - beforeEach(() => { vi.clearAllMocks(); propsService.getDisabledDataSource.mockReturnValue(false); diff --git a/packages/editor/tests/unit/layouts/sidebar/code-block/CodeBlockList.spec.ts b/packages/editor/tests/unit/layouts/sidebar/code-block/CodeBlockList.spec.ts index 0d4b418c..24ff68c6 100644 --- a/packages/editor/tests/unit/layouts/sidebar/code-block/CodeBlockList.spec.ts +++ b/packages/editor/tests/unit/layouts/sidebar/code-block/CodeBlockList.spec.ts @@ -35,11 +35,6 @@ vi.mock('@editor/hooks/use-filter', () => ({ useFilter: () => ({ filterTextChangeHandler: vi.fn() }), })); -vi.mock('@tmagic/core', async () => { - const actual = await vi.importActual('@tmagic/core'); - return { ...actual, DepTargetType: { CODE_BLOCK: 'code-block' } }; -}); - const { messageBoxConfirm, messageError } = vi.hoisted(() => ({ messageBoxConfirm: vi.fn(async () => 'confirm'), messageError: vi.fn(), diff --git a/packages/editor/tests/unit/layouts/sidebar/data-source/DataSourceList.spec.ts b/packages/editor/tests/unit/layouts/sidebar/data-source/DataSourceList.spec.ts index c08c1e9c..b725ce42 100644 --- a/packages/editor/tests/unit/layouts/sidebar/data-source/DataSourceList.spec.ts +++ b/packages/editor/tests/unit/layouts/sidebar/data-source/DataSourceList.spec.ts @@ -32,18 +32,6 @@ vi.mock('@editor/hooks/use-filter', () => ({ useFilter: () => ({ filterTextChangeHandler: vi.fn() }), })); -vi.mock('@tmagic/core', async () => { - const actual = await vi.importActual('@tmagic/core'); - return { - ...actual, - DepTargetType: { - DATA_SOURCE: 'data-source', - DATA_SOURCE_METHOD: 'data-source-method', - DATA_SOURCE_COND: 'data-source-cond', - }, - }; -}); - vi.mock('@editor/components/Tree.vue', () => ({ default: defineComponent({ name: 'TreeStub', diff --git a/packages/editor/tests/unit/layouts/sidebar/layer/use-drag.spec.ts b/packages/editor/tests/unit/layouts/sidebar/layer/use-drag.spec.ts index 5b866eaa..06968f3c 100644 --- a/packages/editor/tests/unit/layouts/sidebar/layer/use-drag.spec.ts +++ b/packages/editor/tests/unit/layouts/sidebar/layer/use-drag.spec.ts @@ -15,17 +15,6 @@ vi.mock('@editor/utils', async () => { }; }); -vi.mock('@tmagic/utils', async () => { - const actual = await vi.importActual('@tmagic/utils'); - return { - ...actual, - addClassName: (el: any, _doc: any, className: string) => el?.classList?.add(className), - removeClassName: (el: any, ...classNames: string[]) => { - classNames.forEach((c) => el?.classList?.remove(c)); - }, - }; -}); - const makeEditorService = () => ({ getNodeInfo: vi.fn(), get: vi.fn(() => []),