mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
fix(NocoBaseRecursionField): ignore x-read-pretty when merging schemas (#5885)
* fix(NocoBaseRecursionField): ignore x-read-pretty when merging schemas * test: add e2e test
This commit is contained in:
parent
a623362ac5
commit
5ff8b19e57
@ -152,12 +152,12 @@ const createMergedSchemaInstance = (schema: Schema, uiSchema: ISchema, onlyRende
|
|||||||
const firstPropertyKey = Object.keys(clonedSchema.properties)[0];
|
const firstPropertyKey = Object.keys(clonedSchema.properties)[0];
|
||||||
const firstPropertyValue = Object.values(clonedSchema.properties)[0];
|
const firstPropertyValue = Object.values(clonedSchema.properties)[0];
|
||||||
// Some uiSchema's type value is "void", which can cause exceptions, so we need to ignore the type field
|
// Some uiSchema's type value is "void", which can cause exceptions, so we need to ignore the type field
|
||||||
clonedSchema.properties[firstPropertyKey] = merge(_.omit(uiSchema, 'type'), firstPropertyValue);
|
clonedSchema.properties[firstPropertyKey] = merge(_.omit(uiSchema, 'type', 'x-read-pretty'), firstPropertyValue);
|
||||||
return new Schema(clonedSchema);
|
return new Schema(clonedSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some uiSchema's type value is "void", which can cause exceptions, so we need to ignore the type field
|
// Some uiSchema's type value is "void", which can cause exceptions, so we need to ignore the type field
|
||||||
return new Schema(merge(_.omit(uiSchema, 'type'), clonedSchema));
|
return new Schema(merge(_.omit(uiSchema, 'type', 'x-read-pretty'), clonedSchema));
|
||||||
};
|
};
|
||||||
|
|
||||||
const propertiesToReactElement = ({
|
const propertiesToReactElement = ({
|
||||||
|
@ -62,6 +62,25 @@ test.describe('form item & edit form', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.describe('form item & filter form', () => {
|
||||||
|
test('should be editable', async ({ page, mockPage, mockRecord }) => {
|
||||||
|
await mockPage().goto();
|
||||||
|
|
||||||
|
// 1. 添加一个 filter form 区块
|
||||||
|
await page.getByLabel('schema-initializer-Grid-page:').hover();
|
||||||
|
await page.getByRole('menuitem', { name: 'Form right' }).nth(1).hover();
|
||||||
|
await page.getByRole('menuitem', { name: 'Users' }).click();
|
||||||
|
|
||||||
|
// 2. 为 filter form 添加一个 createdAt 字段
|
||||||
|
await page.getByLabel('schema-initializer-Grid-filterForm:configureFields-users').hover();
|
||||||
|
await page.getByRole('menuitem', { name: 'Created at' }).first().click();
|
||||||
|
await page.mouse.move(300, 0);
|
||||||
|
|
||||||
|
// 3. createdAt 字段字段应该是可编辑的
|
||||||
|
await expect(page.getByPlaceholder('Select date')).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test.describe('form item & view form', () => {
|
test.describe('form item & view form', () => {
|
||||||
test('configure fields', async ({ page, mockPage, mockRecord }) => {
|
test('configure fields', async ({ page, mockPage, mockRecord }) => {
|
||||||
const nocoPage = await mockPage(oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields).waitForInit();
|
const nocoPage = await mockPage(oneTableBlockWithAddNewAndViewAndEditAndSystemInfoFields).waitForInit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user