From 285f719f9f71d7e9f63253ff9ed317b05875db41 Mon Sep 17 00:00:00 2001
From: jack zhang <1098626505@qq.com>
Date: Thu, 30 May 2024 18:35:20 +0800
Subject: [PATCH] fix: table borded (#4534)
* fix: table borded
* fix: unit test
---
.../__tests__/SchemaToolbar.test.tsx | 18 +++++++++---------
.../schema-initializer/fixures/createApp.tsx | 4 ++--
.../collection-field/CollectionField.test.tsx | 10 +++++-----
.../CollectionFieldProvider.test.tsx | 6 +++---
.../collection/AssociationProvider.test.tsx | 8 ++++----
.../CollectionManagerProvider.test.tsx | 14 +++++++-------
.../collection/CollectionProvider.test.tsx | 10 +++++-----
.../CollectionDeletedPlaceholder.test.tsx | 8 ++++----
.../table/hooks/useTableBlockProps.tsx | 1 +
.../__tests__/admin-layout.test.tsx | 4 ++--
.../__tests__/route-schema-component.test.tsx | 4 ++--
.../DataSourceCollectionCascader.test.tsx | 4 ++--
.../__tests__/DataSourceSelect.test.tsx | 10 +++++-----
.../__tests__/collection-select.test.tsx | 4 ++--
.../__tests__/ColorPicker.test.tsx | 6 +++---
.../antd/form/__tests__/form.settings.test.tsx | 4 ++--
.../schema-component/antd/form/demos/demo9.tsx | 6 ++----
.../grid-card/__tests__/grid-card.test.tsx | 4 ++--
.../antd/list/__tests__/list.test.tsx | 4 ++--
.../__tests__/NanoIDInput.test.tsx | 4 ++--
.../antd/page/__tests__/page.test.tsx | 12 ++++++------
.../pagination/__tests__/pagination.test.tsx | 6 +++---
.../quick-edit/__tests__/QuickEdit.test.tsx | 6 +++---
.../__tests__/UnixTimestamp.test.tsx | 12 ++++++------
.../antd/upload/__tests__/upload.test.tsx | 8 ++++----
packages/core/test/src/client/index.tsx | 2 +-
.../{renderApp.tsx => renderAppOptions.tsx} | 4 ++--
.../core/test/src/client/renderSettings.tsx | 4 ++--
28 files changed, 93 insertions(+), 94 deletions(-)
rename packages/core/test/src/client/{renderApp.tsx => renderAppOptions.tsx} (80%)
diff --git a/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx b/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx
index b1a67a31f..835d23598 100644
--- a/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx
+++ b/packages/core/client/src/application/__tests__/SchemaToolbar.test.tsx
@@ -35,7 +35,7 @@ describe('SchemaToolbar', () => {
});
describe('useSchemaToolbarRender()', () => {
- const renderApp = (demoSchema: any, designable = true) => {
+ const renderAppOptions = (demoSchema: any, designable = true) => {
const Demo = () =>
Demo
;
const CustomToolbar = (props) => {
@@ -81,7 +81,7 @@ describe('SchemaToolbar', () => {
};
test('Render x-designer if x-designer has a value', () => {
- renderApp({
+ renderAppOptions({
'x-designer': 'CustomToolbar',
});
@@ -91,7 +91,7 @@ describe('SchemaToolbar', () => {
});
test('Render x-toolbar if it has a value', () => {
- renderApp({
+ renderAppOptions({
'x-toolbar': 'CustomToolbar',
});
@@ -99,7 +99,7 @@ describe('SchemaToolbar', () => {
});
test('Render x-toolbar if both x-toolbar and x-designer have values', () => {
- renderApp({
+ renderAppOptions({
'x-toolbar': 'CustomToolbar',
'x-designer': 'CustomToolbar',
});
@@ -108,7 +108,7 @@ describe('SchemaToolbar', () => {
});
test('Render the default SchemaToolbar component if x-toolbar and x-designer have no values and x-settings has a value', () => {
- renderApp({
+ renderAppOptions({
'x-settings': 'DemoSettings',
});
@@ -117,14 +117,14 @@ describe('SchemaToolbar', () => {
});
test('Do not render if x-toolbar and x-designer have no values and x-settings also has no value', () => {
- renderApp({});
+ renderAppOptions({});
expect(screen.getByTestId('toolbar')).toHaveTextContent('');
expect(screen.getByTestId('toolbar-exists')).toHaveTextContent('false');
});
test('Do not render if the component corresponding to x-toolbar cannot be found', () => {
- renderApp({
+ renderAppOptions({
'x-toolbar': 'NotFound',
});
@@ -132,7 +132,7 @@ describe('SchemaToolbar', () => {
});
test('Do not render if designable is false', () => {
- renderApp(
+ renderAppOptions(
{
'x-designer': 'CustomToolbar',
},
@@ -143,7 +143,7 @@ describe('SchemaToolbar', () => {
});
test('x-toolbar-props and custom Props', () => {
- renderApp({
+ renderAppOptions({
'x-toolbar': 'CustomToolbar',
'x-toolbar-props': {
test: '123',
diff --git a/packages/core/client/src/application/__tests__/schema-initializer/fixures/createApp.tsx b/packages/core/client/src/application/__tests__/schema-initializer/fixures/createApp.tsx
index c38c9d5c1..7a7b5bb39 100644
--- a/packages/core/client/src/application/__tests__/schema-initializer/fixures/createApp.tsx
+++ b/packages/core/client/src/application/__tests__/schema-initializer/fixures/createApp.tsx
@@ -9,7 +9,7 @@
import React from 'react';
import { observer } from '@formily/reactive-react';
-import { renderApp } from '@nocobase/test/client';
+import { renderAppOptions } from '@nocobase/test/client';
import {
SchemaComponent,
SchemaInitializer,
@@ -83,7 +83,7 @@ export async function createApp(options = {}, appOptions = {}) {
/>
);
};
- await renderApp({
+ await renderAppOptions({
appOptions: {
providers: [Root],
schemaInitializers: [testInitializers],
diff --git a/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx b/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx
index 007286ac8..e04dc28c6 100644
--- a/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx
+++ b/packages/core/client/src/data-source/__tests__/collection-field/CollectionField.test.tsx
@@ -22,7 +22,7 @@ import { render, screen } from '@nocobase/test/client';
import React from 'react';
import collections from '../collections.json';
-function renderApp(fieldName: string, components = {}) {
+function renderAppOptions(fieldName: string, components = {}) {
const noUiSchema = {
key: 'no-ui-schema',
name: 'no-ui-schema',
@@ -99,7 +99,7 @@ function renderApp(fieldName: string, components = {}) {
describe('CollectionField', () => {
it('works', () => {
- renderApp('nickname');
+ renderAppOptions('nickname');
expect(screen.getByText('Nickname')).toBeInTheDocument();
expect(screen.getByRole('textbox')).toHaveClass('ant-input');
});
@@ -109,18 +109,18 @@ describe('CollectionField', () => {
const field = useCollectionField();
return {field?.name}
;
};
- renderApp('nickname', { Input });
+ renderAppOptions('nickname', { Input });
expect(document.querySelector('.input-test-1')).toHaveTextContent('nickname');
});
it('useComponentProps', () => {
- renderApp('dynamic-props');
+ renderAppOptions('dynamic-props');
expect(document.querySelector('.ant-input')).toHaveAttribute('placeholder', 'placeholder');
expect(screen.queryByText('addonBefore')).toBeInTheDocument();
});
it('no schema', () => {
- renderApp('no-ui-schema');
+ renderAppOptions('no-ui-schema');
expect(document.querySelector('.ant-formily-item-control-content-component')).toHaveTextContent('');
});
});
diff --git a/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx
index 5d3cc9c79..2038b1a53 100644
--- a/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx
+++ b/packages/core/client/src/data-source/__tests__/collection-field/CollectionFieldProvider.test.tsx
@@ -19,7 +19,7 @@ import {
} from '@nocobase/client';
import collections from '../collections.json';
-function renderApp(Demo: ComponentType, name?: string) {
+function renderAppOptions(Demo: ComponentType, name?: string) {
const app = new Application({
dataSourceManager: {
collections: collections as any,
@@ -51,7 +51,7 @@ describe('CollectionFieldProvider', () => {
);
};
- renderApp(Demo, 'nickname');
+ renderAppOptions(Demo, 'nickname');
expect(screen.getByTestId('demo')).toHaveTextContent('nickname');
});
@@ -61,7 +61,7 @@ describe('CollectionFieldProvider', () => {
return children
;
};
- renderApp(Demo, 'not-exists');
+ renderAppOptions(Demo, 'not-exists');
expect(document.body.innerHTML).toContain('ant-typography');
expect(document.body.innerHTML).not.toContain('children');
diff --git a/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx
index 7a7d5a868..28a0f7667 100644
--- a/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx
+++ b/packages/core/client/src/data-source/__tests__/collection/AssociationProvider.test.tsx
@@ -21,7 +21,7 @@ import {
} from '@nocobase/client';
import collections from '../collections.json';
-function renderApp(Demo: ComponentType, props: any = {}) {
+function renderAppOptions(Demo: ComponentType, props: any = {}) {
const app = new Application({
dataSourceManager: {
collections: collections as any,
@@ -69,7 +69,7 @@ describe('AssociationProvider', () => {
);
};
- renderApp(Demo, { name: 'users.roles' });
+ renderAppOptions(Demo, { name: 'users.roles' });
expect(screen.getByTestId('collection')).toHaveTextContent('roles');
expect(screen.getByTestId('parent-collection')).toHaveTextContent('users');
@@ -90,7 +90,7 @@ describe('AssociationProvider', () => {
);
};
- renderApp(Demo, { name: 'users.roles', dataSource: 'a' });
+ renderAppOptions(Demo, { name: 'users.roles', dataSource: 'a' });
expect(screen.getByTestId('collection')).toHaveTextContent('roles');
expect(screen.getByTestId('parent-collection')).toHaveTextContent('users');
@@ -101,7 +101,7 @@ describe('AssociationProvider', () => {
const Demo = () => {
return Demo
;
};
- renderApp(Demo, { name: 'users.not-exists' });
+ renderAppOptions(Demo, { name: 'users.not-exists' });
expect(screen.getByText('Delete')).toBeInTheDocument();
expect(
diff --git a/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx
index 7708b16a9..92d172e82 100644
--- a/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx
+++ b/packages/core/client/src/data-source/__tests__/collection/CollectionManagerProvider.test.tsx
@@ -20,7 +20,7 @@ import {
} from '@nocobase/client';
import collections from '../collections.json';
-function renderApp(Demo: ComponentType, dataSource?: string) {
+function renderAppOptions(Demo: ComponentType, dataSource?: string) {
const app = new Application({
dataSourceManager: {
collections: collections as any,
@@ -50,7 +50,7 @@ describe('CollectionManagerProvider', () => {
const users = cm.getCollection('users');
return {users.name}
;
};
- renderApp(Demo);
+ renderAppOptions(Demo);
expect(screen.getByTestId('demo')).toHaveTextContent('users');
});
@@ -60,7 +60,7 @@ describe('CollectionManagerProvider', () => {
const collections = useCollections();
return {collections.length}
;
};
- renderApp(Demo);
+ renderAppOptions(Demo);
expect(screen.getByTestId('demo')).toHaveTextContent('2');
});
@@ -70,7 +70,7 @@ describe('CollectionManagerProvider', () => {
const collections = useCollections((collection) => collection.name === 'users');
return {collections.length}
;
};
- renderApp(Demo);
+ renderAppOptions(Demo);
expect(screen.getByTestId('demo')).toHaveTextContent('1');
});
@@ -80,7 +80,7 @@ describe('CollectionManagerProvider', () => {
const collections = useCollections();
return {collections.length}
;
};
- renderApp(Demo, 'a');
+ renderAppOptions(Demo, 'a');
expect(screen.getByTestId('demo')).toHaveTextContent('1');
});
@@ -99,7 +99,7 @@ describe('CollectionManagerProvider', () => {
);
};
- renderApp(Wrapper, 'a');
+ renderAppOptions(Wrapper, 'a');
expect(screen.getByTestId('demo')).toHaveTextContent('2');
});
@@ -120,7 +120,7 @@ describe('CollectionManagerProvider', () => {
);
};
- renderApp(Wrapper, 'a');
+ renderAppOptions(Wrapper, 'a');
expect(screen.getByTestId('demo')).toHaveTextContent('2');
});
diff --git a/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx b/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx
index 6e60f7b71..38fd69ddc 100644
--- a/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx
+++ b/packages/core/client/src/data-source/__tests__/collection/CollectionProvider.test.tsx
@@ -20,7 +20,7 @@ import {
} from '@nocobase/client';
import collections from '../collections.json';
-function renderApp(Demo: ComponentType, props: any = {}) {
+function renderAppOptions(Demo: ComponentType, props: any = {}) {
const app = new Application({
dataSourceManager: {
collections: collections as any,
@@ -58,7 +58,7 @@ describe('CollectionProvider', () => {
);
};
- renderApp(Demo, { name: 'users' });
+ renderAppOptions(Demo, { name: 'users' });
expect(screen.getByTestId('name')).toHaveTextContent('users');
@@ -74,7 +74,7 @@ describe('CollectionProvider', () => {
return children
;
};
- renderApp(Demo, { name: 'not-exists', allowNull: true });
+ renderAppOptions(Demo, { name: 'not-exists', allowNull: true });
expect(screen.getByTestId('children')).toHaveTextContent('children');
});
@@ -87,7 +87,7 @@ describe('CollectionProvider', () => {
return children
;
};
- renderApp(Demo, { name: 'not-exists', allowNull: false });
+ renderAppOptions(Demo, { name: 'not-exists', allowNull: false });
expect(screen.getByText('Delete')).toBeInTheDocument();
});
@@ -98,7 +98,7 @@ describe('CollectionProvider', () => {
return {fields.length}
;
};
- renderApp(Demo, { name: 'users' });
+ renderAppOptions(Demo, { name: 'users' });
expect(screen.getByTestId('fields')).toHaveTextContent('1');
});
diff --git a/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx b/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx
index f6694b2b7..2d5ec4df4 100644
--- a/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx
+++ b/packages/core/client/src/data-source/__tests__/components/CollectionDeletedPlaceholder.test.tsx
@@ -13,7 +13,7 @@ import { render, screen, userEvent, waitFor } from '@nocobase/test/client';
import { CollectionDeletedPlaceholder, SchemaComponent, SchemaComponentProvider } from '@nocobase/client';
import { App } from 'antd';
-function renderApp(name?: any, designable?: boolean) {
+function renderAppOptions(name?: any, designable?: boolean) {
const schema = {
name: 'root',
type: 'void',
@@ -37,7 +37,7 @@ function renderApp(name?: any, designable?: boolean) {
describe('CollectionDeletedPlaceholder', () => {
test('name is undefined, render `Result` component', async () => {
- renderApp(undefined, true);
+ renderAppOptions(undefined, true);
expect(screen.getByText('Delete')).toBeInTheDocument();
expect(screen.getByText('Collection name is required')).toBeInTheDocument();
@@ -55,7 +55,7 @@ describe('CollectionDeletedPlaceholder', () => {
});
test('designable: true, render `Result` component', () => {
- renderApp('test', true);
+ renderAppOptions('test', true);
expect(screen.getByText('Delete')).toBeInTheDocument();
expect(
screen.getByText('The collection "test" may have been deleted. Please remove this block.'),
@@ -63,7 +63,7 @@ describe('CollectionDeletedPlaceholder', () => {
});
test('designable: false, render nothing', () => {
- renderApp('test', false);
+ renderAppOptions('test', false);
expect(screen.queryByText('Delete')).not.toBeInTheDocument();
});
diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx
index 2bad8e5c0..7c54943b4 100644
--- a/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx
+++ b/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx
@@ -51,6 +51,7 @@ export const useTableBlockProps = () => {
}, [field, ctx?.service?.data, isLoading, ctx?.field?.data?.selectedRowKeys]);
return {
+ bordered: ctx.bordered,
childrenColumnName: ctx.childrenColumnName,
loading: ctx?.service?.loading,
showIndex: ctx.showIndex,
diff --git a/packages/core/client/src/route-switch/antd/admin-layout/__tests__/admin-layout.test.tsx b/packages/core/client/src/route-switch/antd/admin-layout/__tests__/admin-layout.test.tsx
index 94162095e..55bfdbdd1 100644
--- a/packages/core/client/src/route-switch/antd/admin-layout/__tests__/admin-layout.test.tsx
+++ b/packages/core/client/src/route-switch/antd/admin-layout/__tests__/admin-layout.test.tsx
@@ -8,12 +8,12 @@
*/
import { ACLMenuItemProvider, AdminLayout, BlockSchemaComponentPlugin, CurrentUserProvider } from '@nocobase/client';
-import { renderApp, waitFor, screen } from '@nocobase/test/client';
+import { renderAppOptions, waitFor, screen } from '@nocobase/test/client';
import React from 'react';
describe('AdminLayout', () => {
it('should render correctly', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
noWrapperSchema: true,
appOptions: {
diff --git a/packages/core/client/src/route-switch/antd/route-schema-component/__tests__/route-schema-component.test.tsx b/packages/core/client/src/route-switch/antd/route-schema-component/__tests__/route-schema-component.test.tsx
index a43ac51a1..badf4389e 100644
--- a/packages/core/client/src/route-switch/antd/route-schema-component/__tests__/route-schema-component.test.tsx
+++ b/packages/core/client/src/route-switch/antd/route-schema-component/__tests__/route-schema-component.test.tsx
@@ -8,12 +8,12 @@
*/
import { RouteSchemaComponent } from '@nocobase/client';
-import { renderApp, waitFor, screen } from '@nocobase/test/client';
+import { renderAppOptions, waitFor, screen } from '@nocobase/test/client';
import React from 'react';
describe('route-schema-component', () => {
it('should render correctly', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
noWrapperSchema: true,
appOptions: {
diff --git a/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceCollectionCascader.test.tsx b/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceCollectionCascader.test.tsx
index 5aab8d6f9..ede8d78bc 100644
--- a/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceCollectionCascader.test.tsx
+++ b/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceCollectionCascader.test.tsx
@@ -7,12 +7,12 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
-import { renderApp, screen, userEvent, waitFor } from '@nocobase/test/client';
+import { renderAppOptions, screen, userEvent, waitFor } from '@nocobase/test/client';
import { DataSourceCollectionCascader } from '../CollectionSelect';
describe('DataSourceCollectionCascader', () => {
test('should works', async () => {
- await renderApp({
+ await renderAppOptions({
enableMultipleDataSource: true,
schema: {
type: 'string',
diff --git a/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceSelect.test.tsx b/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceSelect.test.tsx
index ddb8a1137..2fb41bc7d 100644
--- a/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceSelect.test.tsx
+++ b/packages/core/client/src/schema-component/antd/collection-select/__tests__/DataSourceSelect.test.tsx
@@ -7,12 +7,12 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
-import { renderApp, screen, userEvent, waitFor, renderReadPrettyApp } from '@nocobase/test/client';
+import { renderAppOptions, screen, userEvent, waitFor, renderReadPrettyApp } from '@nocobase/test/client';
import { DataSourceSelect } from '../CollectionSelect';
describe('DataSourceSelect', () => {
test('single', async () => {
- await renderApp({
+ await renderAppOptions({
Component: DataSourceSelect,
});
@@ -23,7 +23,7 @@ describe('DataSourceSelect', () => {
});
test('multiple', async () => {
- await renderApp({
+ await renderAppOptions({
enableMultipleDataSource: true,
schema: {
type: 'string',
@@ -39,7 +39,7 @@ describe('DataSourceSelect', () => {
});
test('change', async () => {
- await renderApp({
+ await renderAppOptions({
enableMultipleDataSource: true,
schema: {
type: 'string',
@@ -54,7 +54,7 @@ describe('DataSourceSelect', () => {
});
test('filter', async () => {
- await renderApp({
+ await renderAppOptions({
enableMultipleDataSource: true,
schema: {
type: 'string',
diff --git a/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx b/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx
index bac8168f8..ace2b5b6d 100644
--- a/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx
+++ b/packages/core/client/src/schema-component/antd/collection-select/__tests__/collection-select.test.tsx
@@ -7,12 +7,12 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
-import { renderReadPrettyApp, renderApp, screen, userEvent, waitFor } from '@nocobase/test/client';
+import { renderReadPrettyApp, renderAppOptions, screen, userEvent, waitFor } from '@nocobase/test/client';
import { FormItem, CollectionSelect } from '@nocobase/client';
describe('CollectionSelect', () => {
it('should works', async () => {
- const { container } = await renderApp({
+ const { container } = await renderAppOptions({
schema: {
type: 'object',
properties: {
diff --git a/packages/core/client/src/schema-component/antd/color-picker/__tests__/ColorPicker.test.tsx b/packages/core/client/src/schema-component/antd/color-picker/__tests__/ColorPicker.test.tsx
index 6f822beb9..7adc68efd 100644
--- a/packages/core/client/src/schema-component/antd/color-picker/__tests__/ColorPicker.test.tsx
+++ b/packages/core/client/src/schema-component/antd/color-picker/__tests__/ColorPicker.test.tsx
@@ -8,11 +8,11 @@
*/
import { ColorPicker } from '@nocobase/client';
-import { renderApp, screen, renderReadPrettyApp, userEvent, waitFor } from '@nocobase/test/client';
+import { renderAppOptions, screen, renderReadPrettyApp, userEvent, waitFor } from '@nocobase/test/client';
describe('ColorPicker', () => {
test('basic', async () => {
- const { container } = await renderApp({
+ const { container } = await renderAppOptions({
Component: ColorPicker,
value: 'rgb(139, 187, 17)',
});
@@ -53,7 +53,7 @@ describe('ColorPicker', () => {
});
test('change', async () => {
- const { container } = await renderApp({
+ const { container } = await renderAppOptions({
Component: ColorPicker,
value: 'rgb(139, 187, 17)',
});
diff --git a/packages/core/client/src/schema-component/antd/form/__tests__/form.settings.test.tsx b/packages/core/client/src/schema-component/antd/form/__tests__/form.settings.test.tsx
index 2341c5215..5dbef9f99 100644
--- a/packages/core/client/src/schema-component/antd/form/__tests__/form.settings.test.tsx
+++ b/packages/core/client/src/schema-component/antd/form/__tests__/form.settings.test.tsx
@@ -8,13 +8,13 @@
*/
import { BlockSchemaComponentPlugin, FormBlockProvider, VariablesProvider } from '@nocobase/client';
-import { checkSettings, renderApp } from '@nocobase/test/client';
+import { checkSettings, renderAppOptions } from '@nocobase/test/client';
import { withSchema } from '@nocobase/test/web';
describe('form.settings', () => {
test('new schema version', async () => {
const FormBlockProviderWithSchema = withSchema(FormBlockProvider);
- await renderApp({
+ await renderAppOptions({
designable: true,
schema: {
_isJSONSchemaObject: true,
diff --git a/packages/core/client/src/schema-component/antd/form/demos/demo9.tsx b/packages/core/client/src/schema-component/antd/form/demos/demo9.tsx
index 897e40c7e..b8f0f88dd 100644
--- a/packages/core/client/src/schema-component/antd/form/demos/demo9.tsx
+++ b/packages/core/client/src/schema-component/antd/form/demos/demo9.tsx
@@ -1,10 +1,8 @@
-
-
import { BlockSchemaComponentPlugin, VariablesProvider } from '@nocobase/client';
-import { renderApp } from '@nocobase/test/client';
+import { renderAppOptions } from '@nocobase/test/client';
export const renderDemo9 = () =>
- renderApp({
+ renderAppOptions({
designable: true,
schema: {
_isJSONSchemaObject: true,
diff --git a/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx b/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx
index bae1afb1a..1c118883e 100644
--- a/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx
+++ b/packages/core/client/src/schema-component/antd/grid-card/__tests__/grid-card.test.tsx
@@ -8,11 +8,11 @@
*/
import { BlockSchemaComponentPlugin } from '@nocobase/client';
-import { renderApp, waitFor, screen, userEvent } from '@nocobase/test/client';
+import { renderAppOptions, waitFor, screen, userEvent } from '@nocobase/test/client';
describe('GridCard', () => {
it('should render correctly', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
schema: {
_isJSONSchemaObject: true,
diff --git a/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx b/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx
index b5c766a75..c1171717d 100644
--- a/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx
+++ b/packages/core/client/src/schema-component/antd/list/__tests__/list.test.tsx
@@ -8,11 +8,11 @@
*/
import { BlockSchemaComponentPlugin } from '@nocobase/client';
-import { renderApp, waitFor, screen, userEvent } from '@nocobase/test/client';
+import { renderAppOptions, waitFor, screen, userEvent } from '@nocobase/test/client';
describe('List', () => {
it('should render correctly', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
schema: {
type: 'void',
diff --git a/packages/core/client/src/schema-component/antd/nanoid-input/__tests__/NanoIDInput.test.tsx b/packages/core/client/src/schema-component/antd/nanoid-input/__tests__/NanoIDInput.test.tsx
index 994297fbf..eeeaa33b7 100644
--- a/packages/core/client/src/schema-component/antd/nanoid-input/__tests__/NanoIDInput.test.tsx
+++ b/packages/core/client/src/schema-component/antd/nanoid-input/__tests__/NanoIDInput.test.tsx
@@ -8,11 +8,11 @@
*/
import { BlockSchemaComponentPlugin } from '@nocobase/client';
-import { screen, renderApp, renderReadPrettyApp, userEvent, waitFor } from '@nocobase/test/client';
+import { screen, renderAppOptions, renderReadPrettyApp, userEvent, waitFor } from '@nocobase/test/client';
describe('NanoIDInput', () => {
test('basic', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
enableUserListDataBlock: true,
schema: {
diff --git a/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx b/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx
index 439870ef7..22a338eba 100644
--- a/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx
+++ b/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx
@@ -7,7 +7,7 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
-import { render, screen, waitFor, renderApp, userEvent } from '@nocobase/test/client';
+import { render, screen, waitFor, renderAppOptions, userEvent } from '@nocobase/test/client';
import React from 'react';
import App1 from '../demos/demo1';
import { Page } from '../Page';
@@ -31,7 +31,7 @@ describe('Page', () => {
describe('Page Component', () => {
const title = 'Test Title';
test('schema title', async () => {
- await renderApp({
+ await renderAppOptions({
schema: {
type: 'void',
title,
@@ -43,7 +43,7 @@ describe('Page', () => {
});
test('hide title', async () => {
- await renderApp({
+ await renderAppOptions({
schema: {
type: 'void',
title,
@@ -58,7 +58,7 @@ describe('Page', () => {
});
test('should request remote schema when no title', async () => {
- await renderApp({
+ await renderAppOptions({
schema: {
type: 'void',
'x-uid': 'test',
@@ -80,7 +80,7 @@ describe('Page', () => {
});
test('enablePageTabs', async () => {
- await renderApp({
+ await renderAppOptions({
schema: {
type: 'void',
title,
@@ -118,7 +118,7 @@ describe('Page', () => {
});
test('add tab', async () => {
- await renderApp({
+ await renderAppOptions({
schema: {
type: 'void',
title,
diff --git a/packages/core/client/src/schema-component/antd/pagination/__tests__/pagination.test.tsx b/packages/core/client/src/schema-component/antd/pagination/__tests__/pagination.test.tsx
index bcb8c5897..6f711c239 100644
--- a/packages/core/client/src/schema-component/antd/pagination/__tests__/pagination.test.tsx
+++ b/packages/core/client/src/schema-component/antd/pagination/__tests__/pagination.test.tsx
@@ -7,12 +7,12 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
-import { renderApp } from '@nocobase/test/client';
+import { renderAppOptions } from '@nocobase/test/client';
import { Pagination } from '@nocobase/client';
describe('Pagination', () => {
it('renders without errors', async () => {
- const { container } = await renderApp({
+ const { container } = await renderAppOptions({
Component: Pagination,
props: {
total: 20,
@@ -122,7 +122,7 @@ describe('Pagination', () => {
});
it('hides when hidden prop is true', async () => {
- const { container } = await renderApp({
+ const { container } = await renderAppOptions({
Component: Pagination,
props: {
hidden: true,
diff --git a/packages/core/client/src/schema-component/antd/quick-edit/__tests__/QuickEdit.test.tsx b/packages/core/client/src/schema-component/antd/quick-edit/__tests__/QuickEdit.test.tsx
index f412b3bd7..7b43ebe1d 100644
--- a/packages/core/client/src/schema-component/antd/quick-edit/__tests__/QuickEdit.test.tsx
+++ b/packages/core/client/src/schema-component/antd/quick-edit/__tests__/QuickEdit.test.tsx
@@ -8,7 +8,7 @@
*/
import { BlockSchemaComponentPlugin } from '@nocobase/client';
-import { screen, renderApp, sleep, userEvent, waitFor } from '@nocobase/test/client';
+import { screen, renderAppOptions, sleep, userEvent, waitFor } from '@nocobase/test/client';
describe('QuickEdit', () => {
function getRenderOptions(readPretty = false) {
@@ -119,7 +119,7 @@ describe('QuickEdit', () => {
}
it('basic', async () => {
- await renderApp(getRenderOptions());
+ await renderAppOptions(getRenderOptions());
await waitFor(() => {
expect(document.querySelector('.ant-table-footer button')).toBeInTheDocument();
@@ -143,7 +143,7 @@ describe('QuickEdit', () => {
});
it('read pretty', async () => {
- await renderApp(getRenderOptions(true));
+ await renderAppOptions(getRenderOptions(true));
await waitFor(() => {
expect(document.querySelector('.ant-table-footer button')).toBeInTheDocument();
diff --git a/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx b/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx
index fe7ed6803..ba82c7314 100644
--- a/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx
+++ b/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx
@@ -7,12 +7,12 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
-import { screen, renderApp, userEvent, waitFor, renderReadPrettyApp } from '@nocobase/test/client';
+import { screen, renderAppOptions, userEvent, waitFor, renderReadPrettyApp } from '@nocobase/test/client';
import { UnixTimestamp } from '@nocobase/client';
describe('UnixTimestamp', () => {
it('renders without errors', async () => {
- const { container } = await renderApp({
+ const { container } = await renderAppOptions({
Component: UnixTimestamp,
props: {
accuracy: 'millisecond',
@@ -70,7 +70,7 @@ describe('UnixTimestamp', () => {
});
it('millisecond', async () => {
- await renderApp({
+ await renderAppOptions({
Component: UnixTimestamp,
value: 1712819630000,
props: {
@@ -83,7 +83,7 @@ describe('UnixTimestamp', () => {
});
it('second', async () => {
- await renderApp({
+ await renderAppOptions({
Component: UnixTimestamp,
value: 1712819630,
props: {
@@ -97,7 +97,7 @@ describe('UnixTimestamp', () => {
});
it('string', async () => {
- await renderApp({
+ await renderAppOptions({
Component: UnixTimestamp,
value: '2024-04-11',
props: {
@@ -112,7 +112,7 @@ describe('UnixTimestamp', () => {
it('change', async () => {
const onChange = vitest.fn();
- await renderApp({
+ await renderAppOptions({
Component: UnixTimestamp,
value: '2024-04-11',
onChange,
diff --git a/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx b/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx
index 82d60f25a..7f8c3fca9 100644
--- a/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx
+++ b/packages/core/client/src/schema-component/antd/upload/__tests__/upload.test.tsx
@@ -13,7 +13,7 @@ import App1 from '../demos/demo1';
import App2 from '../demos/demo2';
import { BlockSchemaComponentPlugin } from '@nocobase/client';
-import { screen, renderApp, renderReadPrettyApp, userEvent, waitFor } from '@nocobase/test/client';
+import { screen, renderAppOptions, renderReadPrettyApp, userEvent, waitFor } from '@nocobase/test/client';
describe('Upload', () => {
it('basic', () => {
@@ -25,7 +25,7 @@ describe('Upload', () => {
});
it('upload single', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
enableUserListDataBlock: true,
schema: {
@@ -124,7 +124,7 @@ describe('Upload', () => {
});
it('upload multi', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
enableUserListDataBlock: true,
schema: {
@@ -214,7 +214,7 @@ describe('Upload', () => {
});
it('delete', async () => {
- await renderApp({
+ await renderAppOptions({
designable: true,
enableUserListDataBlock: true,
schema: {
diff --git a/packages/core/test/src/client/index.tsx b/packages/core/test/src/client/index.tsx
index 52ee5f0f9..ed4aebfbf 100644
--- a/packages/core/test/src/client/index.tsx
+++ b/packages/core/test/src/client/index.tsx
@@ -40,7 +40,7 @@ export { default as userEvent } from '@testing-library/user-event';
// override render export
export { customRender as render, sleep };
-export * from './renderApp';
+export * from './renderAppOptions';
export * from './renderHookWithApp';
export * from './renderSettings';
export * from './renderSingleSettings';
diff --git a/packages/core/test/src/client/renderApp.tsx b/packages/core/test/src/client/renderAppOptions.tsx
similarity index 80%
rename from packages/core/test/src/client/renderApp.tsx
rename to packages/core/test/src/client/renderAppOptions.tsx
index c7cd45947..4d5c76393 100644
--- a/packages/core/test/src/client/renderApp.tsx
+++ b/packages/core/test/src/client/renderAppOptions.tsx
@@ -12,7 +12,7 @@ import { render } from '@testing-library/react';
import { GetAppComponentOptions, addXReadPrettyToEachLayer, getAppComponent } from '../web';
import { WaitApp } from './utils';
-export const renderApp = async (options: GetAppComponentOptions) => {
+export const renderAppOptions = async (options: GetAppComponentOptions) => {
const App = getAppComponent(options);
const res = render();
@@ -23,5 +23,5 @@ export const renderApp = async (options: GetAppComponentOptions) => {
};
export const renderReadPrettyApp = (options: GetAppComponentOptions) => {
- return renderApp({ ...options, schema: addXReadPrettyToEachLayer(options.schema) });
+ return renderAppOptions({ ...options, schema: addXReadPrettyToEachLayer(options.schema) });
};
diff --git a/packages/core/test/src/client/renderSettings.tsx b/packages/core/test/src/client/renderSettings.tsx
index 5fe281b35..1422698d9 100644
--- a/packages/core/test/src/client/renderSettings.tsx
+++ b/packages/core/test/src/client/renderSettings.tsx
@@ -10,7 +10,7 @@
import { waitFor, screen } from '@testing-library/react';
import { GetAppComponentOptions } from '../web';
import userEvent from '@testing-library/user-event';
-import { renderApp, renderReadPrettyApp } from './renderApp';
+import { renderAppOptions, renderReadPrettyApp } from './renderAppOptions';
import { expectNoTsError } from './utils';
export async function showSettingsMenu(container: HTMLElement | Document = document) {
@@ -30,7 +30,7 @@ export interface RenderSettingsOptions extends GetAppComponentOptions {
}
export const renderSettings = async (options: RenderSettingsOptions = {}) => {
const { container = () => document, ...appOptions } = options;
- const result = await renderApp({ ...appOptions, designable: true });
+ const result = await renderAppOptions({ ...appOptions, designable: true });
const containerElement = container();