mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 11:07:52 +08:00
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import React = require('react');
|
|
import {render, fireEvent} from '@testing-library/react';
|
|
import '../../src/themes/default';
|
|
import {render as amisRender} from '../../src/index';
|
|
import {makeEnv} from '../helper';
|
|
|
|
test('Renderer:dropdown-button', async () => {
|
|
const {container} = render(
|
|
amisRender(
|
|
{
|
|
type: 'dropdown-button',
|
|
level: 'primary',
|
|
buttons: [
|
|
{
|
|
type: 'button',
|
|
label: '按钮',
|
|
actionType: 'dialog',
|
|
dialog: {
|
|
title: '系统提示',
|
|
body: '对你点击了'
|
|
}
|
|
},
|
|
{
|
|
type: 'button',
|
|
label: '按钮',
|
|
actionType: 'dialog',
|
|
dialog: {
|
|
title: '系统提示',
|
|
body: '对你点击了'
|
|
}
|
|
},
|
|
{
|
|
type: 'button',
|
|
label: '按钮',
|
|
visible: false
|
|
}
|
|
],
|
|
className: 'show'
|
|
},
|
|
{},
|
|
makeEnv({})
|
|
)
|
|
);
|
|
|
|
const dropdowmButton = document.querySelector('button.a-Button');
|
|
fireEvent.click(dropdowmButton as HTMLDivElement);
|
|
expect(container).toMatchSnapshot();
|
|
fireEvent.click(dropdowmButton as HTMLDivElement);
|
|
expect(container).toMatchSnapshot();
|
|
});
|