mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:18:34 +08:00
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import React = require('react');
|
|
import {render, cleanup} from '@testing-library/react';
|
|
import '../../../src/themes/default';
|
|
import {render as amisRender} from '../../../src/index';
|
|
import {makeEnv} from '../../helper';
|
|
import {clearStoresCache} from '../../../src/factory';
|
|
|
|
afterEach(() => {
|
|
cleanup();
|
|
clearStoresCache();
|
|
});
|
|
|
|
test('Renderer:switch', async () => {
|
|
const {container} = render(
|
|
amisRender(
|
|
{
|
|
type: 'form',
|
|
title: 'The form',
|
|
controls: [
|
|
{
|
|
name: 'switch',
|
|
className: 'block',
|
|
label: '开关',
|
|
type: 'switch',
|
|
addable: true,
|
|
removeable: true,
|
|
minLength: 1,
|
|
maxLength: 4,
|
|
addButtonText: '新增',
|
|
draggable: true,
|
|
draggableTip: '可通过拖动每行中的【交换】按钮进行顺序调整',
|
|
value: true,
|
|
trueValue: true,
|
|
falseValue: false,
|
|
disabled: false,
|
|
option: 'switch',
|
|
optionAtLeft: false
|
|
}
|
|
],
|
|
submitText: null,
|
|
actions: []
|
|
},
|
|
{},
|
|
makeEnv()
|
|
)
|
|
);
|
|
expect(container).toMatchSnapshot();
|
|
});
|