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:hbox', 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: 'hbox',
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
columnClassName: 'w-sm',
|
|
|
|
controls: [
|
|
|
|
{
|
|
|
|
name: 'text',
|
|
|
|
type: 'text',
|
|
|
|
label: false,
|
|
|
|
placeholder: 'Text'
|
|
|
|
}
|
2019-06-11 10:09:44 +08:00
|
|
|
]
|
2021-06-03 13:05:35 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'tpl',
|
|
|
|
tpl: '其他类型的渲染器'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-06-11 10:09:44 +08:00
|
|
|
],
|
|
|
|
submitText: null,
|
|
|
|
actions: []
|
2021-06-03 13:05:35 +08:00
|
|
|
},
|
|
|
|
{},
|
|
|
|
makeEnv()
|
|
|
|
)
|
|
|
|
);
|
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|