fix(customRequestAction): should not support setting icons and colours (#3632)

* test: add e2e

* fix(customRequest): should not support setting icons and colours
This commit is contained in:
Zeke Zhang 2024-03-06 17:13:06 +08:00 committed by GitHub
parent b5ae9343b5
commit 0ae81f0c2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,22 @@
import { test, expect, oneEmptyTable } from '@nocobase/test/e2e';
test('edit button', async ({ page, mockPage, mockRecord }) => {
await mockPage(oneEmptyTable).goto();
await mockRecord('t_unp4scqamw9');
// 新建一个 custom request action
await page.getByRole('button', { name: 'Actions' }).hover();
await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-').hover();
await page.getByRole('menuitem', { name: 'Customize right' }).hover();
await page.getByRole('menuitem', { name: 'Custom request' }).click();
// 打开编辑按钮弹窗
await page.getByLabel('action-CustomRequestAction-').hover();
await page.getByLabel('designer-schema-settings-CustomRequestAction-actionSettings:customRequest-').hover();
await page.getByRole('menuitem', { name: 'Edit button' }).click();
// 应该只显示标题输入框
await expect(page.getByText('Button title')).toBeVisible();
await expect(page.getByText('Button icon')).not.toBeVisible();
await expect(page.getByText('Button background color')).not.toBeVisible();
});

View File

@ -18,7 +18,10 @@ export const customizeCustomRequestActionSettings = new SchemaSettings({
Component: ButtonEditor,
useComponentProps() {
const { buttonEditorProps } = useSchemaToolbar();
return buttonEditorProps;
return {
isLink: true,
...buttonEditorProps,
};
},
},
{