vendor: amis 6.13.0 base (fork root)

This commit is contained in:
2026-06-16 22:14:57 +08:00
commit 8c8e4247a9
3840 changed files with 2467374 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv} from '../../helper';
test('EventAction:collapse', async () => {
const notify = jest.fn();
const {getByText, container}: any = render(
amisRender(
{
type: 'page',
data: {},
body: [
{
type: 'collapse',
header: '折叠器',
body: [
{
type: 'tpl',
tpl: '内容',
wrapperComponent: '',
inline: false
}
],
onEvent: {
expand: {
weight: 0,
actions: [
{
actionType: 'toast',
args: {
msgType: 'info',
msg: '派发展开事件'
}
}
]
},
collapse: {
weight: 0,
actions: [
{
actionType: 'toast',
args: {
msgType: 'info',
msg: '派发收起事件'
}
}
]
}
}
}
]
},
{},
makeEnv({
notify
})
)
);
fireEvent.click(getByText('折叠器'));
await waitFor(() => {
expect(notify).toHaveBeenCalledWith('info', '派发收起事件', {
msg: '派发收起事件',
msgType: 'info'
});
});
fireEvent.click(getByText('折叠器'));
await waitFor(() => {
expect(notify).toHaveBeenCalledWith('info', '派发展开事件', {
msg: '派发展开事件',
msgType: 'info'
});
});
});