mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 06:29:25 +08:00
refactor: support maxTagCount:'responsive' in multi-select component (#6007)
* refactor: support maxTagCount:'responsive' in multi-select component * fix: test * fix: test * fix: test * fix: test * fix: test * fix: test * fix: test
This commit is contained in:
parent
ec92727a20
commit
390c41a164
@ -152,6 +152,6 @@ test.describe('Link', () => {
|
||||
// After clicking the Link button, the browser URL will change, and the value of the input box using variables will be updated
|
||||
await page.getByLabel('action-Action.Link-Link-').click();
|
||||
await page.waitForTimeout(100);
|
||||
await expect(page.getByLabel('block-item-CollectionField-')).toHaveText(`Roles:adminmemberroot`);
|
||||
await expect(page.getByLabel('block-item-CollectionField-')).toContainText(`Roles:adminmemberroot`);
|
||||
});
|
||||
});
|
||||
|
@ -61,7 +61,7 @@ test.describe('variables', () => {
|
||||
await page.getByRole('menuitemcheckbox', { name: 'Table selected records right' }).click();
|
||||
await page.getByRole('menuitemcheckbox', { name: 'm2m' }).click();
|
||||
await page.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
await expect(page.getByLabel('block-item-CollectionField-')).toHaveText(
|
||||
await expect(page.getByLabel('block-item-CollectionField-')).toContainText(
|
||||
`m2m:${record.m2m.map((r) => r.id).join('')}`,
|
||||
);
|
||||
|
||||
|
@ -109,6 +109,7 @@ const ObjectSelect = (props: SelectProps) => {
|
||||
</Tag>
|
||||
);
|
||||
}}
|
||||
maxTagCount="responsive"
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
@ -176,6 +177,7 @@ const InternalSelect = connect(
|
||||
props.onChange?.(changed === undefined ? null : changed);
|
||||
}}
|
||||
mode={mode}
|
||||
maxTagCount="responsive"
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
@ -36,8 +36,8 @@ describe('Select', () => {
|
||||
await userEvent.click(screen.getByText('福州'));
|
||||
await userEvent.click(selector);
|
||||
fireEvent.click(screen.getByText('浙江'));
|
||||
expect(screen.getAllByText('福州')).toHaveLength(3);
|
||||
expect(screen.getAllByText('浙江')).toHaveLength(3);
|
||||
expect(screen.getAllByText('福州')).toHaveLength(2);
|
||||
expect(screen.getAllByText('浙江')).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('select one & objectValue: true', async () => {
|
||||
|
@ -87,7 +87,7 @@ test.describe('form item & create form', () => {
|
||||
expectConstantValue: async () => {
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany'),
|
||||
).toHaveText(`manyToMany:${recordsOfUser.map((record) => record.id).join('')}`);
|
||||
).toContainText(`manyToMany:${recordsOfUser.map((record) => record.id).join('')}`);
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -137,7 +137,7 @@ test.describe('form item & create form', () => {
|
||||
expectEasyReading: async () => {
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany'),
|
||||
).toHaveText(`manyToMany:${records.map((record) => record.id).join(',')}`);
|
||||
).toContainText(`manyToMany:${records.map((record) => record.id).join(',')}`);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -84,7 +84,7 @@ test.describe('form item & edit form', () => {
|
||||
page
|
||||
.getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany')
|
||||
.getByTestId('select-object-multiple'),
|
||||
).toHaveText(`${record.manyToMany.map((item) => item.id).join('')}`);
|
||||
).toContainText(`${record.manyToMany.map((item) => item.id).join('')}`);
|
||||
},
|
||||
expectReadonly: async () => {
|
||||
await expect(
|
||||
|
@ -77,7 +77,7 @@ test.describe('form item & create form', () => {
|
||||
expectConstantValue: async () => {
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-general-form-general.multipleSelect-multipleSelect'),
|
||||
).toHaveText('multipleSelect:Option1Option2Option3');
|
||||
).toContainText('multipleSelect:Option1Option2Option3');
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -191,7 +191,7 @@ test.describe('form item & edit form', () => {
|
||||
page
|
||||
.getByLabel('block-item-CollectionField-general-form-general.multipleSelect-multipleSelect')
|
||||
.getByTestId('select-multiple'),
|
||||
).toHaveText(`${record.multipleSelect.join('')}`, { ignoreCase: true });
|
||||
).toContainText(`${record.multipleSelect.join('')}`, { ignoreCase: true });
|
||||
},
|
||||
expectReadonly: async () => {
|
||||
await expect(
|
||||
|
@ -84,7 +84,7 @@ test.describe('form item & edit form', () => {
|
||||
page
|
||||
.getByLabel('block-item-CollectionField-general-form-general.oneToMany-oneToMany')
|
||||
.getByTestId('select-object-multiple'),
|
||||
).toHaveText(`${record.oneToMany.map((item) => item.id).join('')}`);
|
||||
).toContainText(`${record.oneToMany.map((item) => item.id).join('')}`);
|
||||
},
|
||||
expectReadonly: async () => {
|
||||
await expect(
|
||||
|
Loading…
x
Reference in New Issue
Block a user