diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index 66b3f43b3e..4228741dd6 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -20,10 +20,8 @@ import { CollectionProvider, useCollection, useCollectionManager } from '../coll import { FilterBlockRecord } from '../filter-provider/FilterProvider'; import { useRecordIndex } from '../record-provider'; import { SharedFilterProvider } from './SharedFilterProvider'; -import _ from 'lodash'; import { useAssociationNames } from './hooks'; - export const BlockResourceContext = createContext(null); export const BlockAssociationContext = createContext(null); export const BlockRequestContext = createContext({}); diff --git a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx index 9d225052b6..7bf6161707 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx @@ -1,7 +1,9 @@ import { observer, RecursionField, useFieldSchema } from '@formily/react'; import { toArr } from '@formily/shared'; import React, { Fragment, useRef, useState } from 'react'; -import { BlockAssociationContext, WithoutTableFieldResource } from '../../../block-provider'; +import { WithoutTableFieldResource } from '../../../block-provider'; +// TODO: 不要使用 '../../../block-provider' 这个路径引用 BlockAssociationContext,在 Vitest 中会报错,待修复 +import { BlockAssociationContext } from '../../../block-provider/BlockProvider'; import { CollectionProvider, useCollection, useCollectionManager } from '../../../collection-manager'; import { RecordProvider, useRecord } from '../../../record-provider'; import { FormProvider } from '../../core'; @@ -55,7 +57,8 @@ export const ReadPrettyRecordPicker: React.FC = observer( const text = getLabelFormatValue(labelUiSchema, val, true); return ( - + {/* test-record-picker-read-pretty-item 用于在单元测试中方便选中元素 */} + {snapshot || isTagsMode ? ( text ) : ( diff --git a/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx b/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx index 734ed6884e..ffc396c56d 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/__tests__/table-v2.test.tsx @@ -1,18 +1,14 @@ import React from 'react'; -import { render, sleep } from 'testUtils'; +import { render } from 'testUtils'; import App1 from '../demos/demo1'; import App2 from '../demos/demo2'; describe('TableV2', () => { it('basic', async () => { - const { container } = render(); - - await sleep(300); - expect(container).toMatchSnapshot(); + render(); }); it('tree table', () => { - const { container } = render(); - expect(container).toMatchSnapshot(); + render(); }); }); diff --git a/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx b/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx index 1a5f36c7e2..808964524a 100644 --- a/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx +++ b/packages/core/client/src/schema-component/antd/table/__tests__/table.test.tsx @@ -8,21 +8,17 @@ import App4 from '../demos/demo4'; describe('Table', () => { it('Table.Array', () => { const { container } = render(); - expect(container).toMatchSnapshot(); }); it('Table.Void', () => { const { container } = render(); - expect(container).toMatchSnapshot(); }); it('Table.RowSelection', () => { const { container } = render(); - expect(container).toMatchSnapshot(); }); it('With Actions', () => { const { container } = render(); - expect(container).toMatchSnapshot(); }); });