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:
Katherine 2025-01-09 10:03:42 +08:00 committed by GitHub
parent ec92727a20
commit 390c41a164
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 12 additions and 10 deletions

View File

@ -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 // 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.getByLabel('action-Action.Link-Link-').click();
await page.waitForTimeout(100); await page.waitForTimeout(100);
await expect(page.getByLabel('block-item-CollectionField-')).toHaveText(`Roles:adminmemberroot`); await expect(page.getByLabel('block-item-CollectionField-')).toContainText(`Roles:adminmemberroot`);
}); });
}); });

View File

@ -61,7 +61,7 @@ test.describe('variables', () => {
await page.getByRole('menuitemcheckbox', { name: 'Table selected records right' }).click(); await page.getByRole('menuitemcheckbox', { name: 'Table selected records right' }).click();
await page.getByRole('menuitemcheckbox', { name: 'm2m' }).click(); await page.getByRole('menuitemcheckbox', { name: 'm2m' }).click();
await page.getByRole('button', { name: 'OK', exact: true }).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('')}`, `m2m:${record.m2m.map((r) => r.id).join('')}`,
); );

View File

@ -109,6 +109,7 @@ const ObjectSelect = (props: SelectProps) => {
</Tag> </Tag>
); );
}} }}
maxTagCount="responsive"
{...others} {...others}
/> />
); );
@ -176,6 +177,7 @@ const InternalSelect = connect(
props.onChange?.(changed === undefined ? null : changed); props.onChange?.(changed === undefined ? null : changed);
}} }}
mode={mode} mode={mode}
maxTagCount="responsive"
/> />
); );
}, },

View File

@ -36,8 +36,8 @@ describe('Select', () => {
await userEvent.click(screen.getByText('福州')); await userEvent.click(screen.getByText('福州'));
await userEvent.click(selector); await userEvent.click(selector);
fireEvent.click(screen.getByText('浙江')); fireEvent.click(screen.getByText('浙江'));
expect(screen.getAllByText('福州')).toHaveLength(3); expect(screen.getAllByText('福州')).toHaveLength(2);
expect(screen.getAllByText('浙江')).toHaveLength(3); expect(screen.getAllByText('浙江')).toHaveLength(2);
}); });
it('select one & objectValue: true', async () => { it('select one & objectValue: true', async () => {

View File

@ -87,7 +87,7 @@ test.describe('form item & create form', () => {
expectConstantValue: async () => { expectConstantValue: async () => {
await expect( await expect(
page.getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany'), 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 () => { expectEasyReading: async () => {
await expect( await expect(
page.getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany'), 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(',')}`);
}, },
}); });
}); });

View File

@ -84,7 +84,7 @@ test.describe('form item & edit form', () => {
page page
.getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany') .getByLabel('block-item-CollectionField-general-form-general.manyToMany-manyToMany')
.getByTestId('select-object-multiple'), .getByTestId('select-object-multiple'),
).toHaveText(`${record.manyToMany.map((item) => item.id).join('')}`); ).toContainText(`${record.manyToMany.map((item) => item.id).join('')}`);
}, },
expectReadonly: async () => { expectReadonly: async () => {
await expect( await expect(

View File

@ -77,7 +77,7 @@ test.describe('form item & create form', () => {
expectConstantValue: async () => { expectConstantValue: async () => {
await expect( await expect(
page.getByLabel('block-item-CollectionField-general-form-general.multipleSelect-multipleSelect'), 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 page
.getByLabel('block-item-CollectionField-general-form-general.multipleSelect-multipleSelect') .getByLabel('block-item-CollectionField-general-form-general.multipleSelect-multipleSelect')
.getByTestId('select-multiple'), .getByTestId('select-multiple'),
).toHaveText(`${record.multipleSelect.join('')}`, { ignoreCase: true }); ).toContainText(`${record.multipleSelect.join('')}`, { ignoreCase: true });
}, },
expectReadonly: async () => { expectReadonly: async () => {
await expect( await expect(

View File

@ -84,7 +84,7 @@ test.describe('form item & edit form', () => {
page page
.getByLabel('block-item-CollectionField-general-form-general.oneToMany-oneToMany') .getByLabel('block-item-CollectionField-general-form-general.oneToMany-oneToMany')
.getByTestId('select-object-multiple'), .getByTestId('select-object-multiple'),
).toHaveText(`${record.oneToMany.map((item) => item.id).join('')}`); ).toContainText(`${record.oneToMany.map((item) => item.id).join('')}`);
}, },
expectReadonly: async () => { expectReadonly: async () => {
await expect( await expect(