2019-06-11 10:09:44 +08:00
|
|
|
import React = require('react');
|
2021-06-03 13:05:35 +08:00
|
|
|
import {render, cleanup} from '@testing-library/react';
|
2022-06-02 10:00:09 +08:00
|
|
|
import '../../../src';
|
|
|
|
import {render as amisRender} from '../../../src';
|
2019-06-11 10:09:44 +08:00
|
|
|
import {makeEnv} from '../../helper';
|
2022-06-02 13:28:23 +08:00
|
|
|
import {clearStoresCache} from '../../../src';
|
2019-06-11 10:09:44 +08:00
|
|
|
|
|
|
|
afterEach(() => {
|
2021-08-18 20:25:51 +08:00
|
|
|
cleanup();
|
|
|
|
clearStoresCache();
|
2019-06-11 10:09:44 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Renderer:array', async () => {
|
2021-08-18 20:25:51 +08:00
|
|
|
const {container} = render(
|
|
|
|
amisRender(
|
|
|
|
{
|
2019-06-11 10:09:44 +08:00
|
|
|
type: 'form',
|
|
|
|
title: 'The form',
|
|
|
|
controls: [
|
2021-08-18 20:25:51 +08:00
|
|
|
{
|
|
|
|
name: 'array',
|
|
|
|
label: '颜色集合',
|
|
|
|
type: 'array',
|
|
|
|
addable: true,
|
|
|
|
removeable: true,
|
|
|
|
minLength: 1,
|
|
|
|
maxLength: 4,
|
|
|
|
addButtonText: '新增',
|
|
|
|
draggable: true,
|
|
|
|
draggableTip: '可通过拖动每行中的【交换】按钮进行顺序调整',
|
|
|
|
value: ['red'],
|
|
|
|
inline: true,
|
|
|
|
items: {
|
|
|
|
type: 'color'
|
2019-06-11 10:09:44 +08:00
|
|
|
}
|
2021-08-18 20:25:51 +08:00
|
|
|
}
|
2019-06-11 10:09:44 +08:00
|
|
|
],
|
|
|
|
submitText: null,
|
|
|
|
actions: []
|
2021-08-18 20:25:51 +08:00
|
|
|
},
|
|
|
|
{},
|
|
|
|
makeEnv()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|