mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 13:38:56 +08:00
0fd296e21d
* feat: 输入框添加字数统计功能 * 更新 snapshot * 多点演示
65 lines
1.5 KiB
TypeScript
65 lines
1.5 KiB
TypeScript
import React = require('react');
|
|
import {render, cleanup, fireEvent} from '@testing-library/react';
|
|
import '../../../src/themes/default';
|
|
import {render as amisRender} from '../../../src/index';
|
|
import {makeEnv, wait} from '../../helper';
|
|
import {clearStoresCache} from '../../../src/factory';
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
clearStoresCache();
|
|
});
|
|
|
|
test('Renderer:checkboxes', async () => {
|
|
const {getByText, container} = render(
|
|
amisRender(
|
|
{
|
|
type: 'form',
|
|
title: 'The form',
|
|
controls: [
|
|
{
|
|
name: 'checkboxes',
|
|
type: 'checkboxes',
|
|
label: 'Checkboxes',
|
|
columnsCount: 1,
|
|
options: [
|
|
{
|
|
label: 'Option A',
|
|
value: 'a'
|
|
},
|
|
{
|
|
label: 'Option B',
|
|
value: 'b'
|
|
},
|
|
{
|
|
label: 'Option C',
|
|
value: 'c'
|
|
},
|
|
{
|
|
label: 'Option D',
|
|
value: 'd'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
type: 'static',
|
|
name: 'checkboxes',
|
|
label: '当前值'
|
|
}
|
|
],
|
|
submitText: null,
|
|
actions: []
|
|
},
|
|
{},
|
|
makeEnv()
|
|
)
|
|
);
|
|
expect(container).toMatchSnapshot();
|
|
await wait(300);
|
|
fireEvent.click(getByText(/Option A/));
|
|
await wait(300);
|
|
fireEvent.click(getByText(/Option B/));
|
|
await wait(300);
|
|
expect(container).toMatchSnapshot();
|
|
});
|