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';
|
2019-06-11 10:09:44 +08:00
|
|
|
import '../../../src/themes/default';
|
2021-06-03 13:05:35 +08:00
|
|
|
import {render as amisRender} from '../../../src/index';
|
2019-06-11 10:09:44 +08:00
|
|
|
import {makeEnv} from '../../helper';
|
2021-06-03 13:05:35 +08:00
|
|
|
import {clearStoresCache} from '../../../src/factory';
|
2019-06-11 10:09:44 +08:00
|
|
|
|
|
|
|
afterEach(() => {
|
2021-06-03 13:05:35 +08:00
|
|
|
cleanup();
|
|
|
|
clearStoresCache();
|
2019-06-11 10:09:44 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Renderer:group', async () => {
|
2021-06-03 13:05:35 +08:00
|
|
|
const {container} = render(
|
|
|
|
amisRender(
|
|
|
|
{
|
2019-06-11 10:09:44 +08:00
|
|
|
type: 'form',
|
|
|
|
title: 'The form',
|
|
|
|
controls: [
|
2021-06-03 13:05:35 +08:00
|
|
|
{
|
|
|
|
type: 'group',
|
|
|
|
mode: 'horizontal',
|
|
|
|
className: 'bg-white',
|
|
|
|
horizontal: {
|
|
|
|
label: 1,
|
|
|
|
right: 10,
|
|
|
|
offset: 1
|
2019-06-11 10:09:44 +08:00
|
|
|
},
|
2021-06-03 13:05:35 +08:00
|
|
|
controls: [
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
name: 'test1',
|
|
|
|
label: 'Label',
|
|
|
|
placeholder: 'Placeholder'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
name: 'test2',
|
|
|
|
label: 'Label',
|
|
|
|
placeholder: 'Placeholder'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'group',
|
|
|
|
mode: 'inline',
|
|
|
|
className: 'bg-white',
|
|
|
|
controls: [
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
name: 'test1',
|
|
|
|
label: 'Label',
|
|
|
|
placeholder: 'Placeholder'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
name: 'test2',
|
|
|
|
label: 'Label',
|
|
|
|
placeholder: 'Placeholder'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'group',
|
|
|
|
direction: 'vertical',
|
|
|
|
controls: [
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
name: 'test1',
|
|
|
|
label: 'Label',
|
|
|
|
placeholder: 'Placeholder'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'text',
|
|
|
|
name: 'test2',
|
|
|
|
label: 'Label',
|
|
|
|
placeholder: 'Placeholder'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-06-11 10:09:44 +08:00
|
|
|
],
|
|
|
|
submitText: null,
|
|
|
|
actions: []
|
2021-06-03 13:05:35 +08:00
|
|
|
},
|
|
|
|
{},
|
|
|
|
makeEnv()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|