amis/__tests__/renderers/Tabs.test.tsx

47 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-07-04 16:24:13 +08:00
import React = require('react');
import {render, cleanup} from '@testing-library/react';
2019-07-04 16:24:13 +08:00
import '../../src/themes/default';
import {render as amisRender} from '../../src/index';
2019-07-04 16:24:13 +08:00
import {makeEnv} from '../helper';
import {clearStoresCache} from '../../src/factory';
2019-07-04 16:24:13 +08:00
afterEach(() => {
cleanup();
clearStoresCache();
2019-07-04 16:24:13 +08:00
});
test('Renderer:tabs', async () => {
const {container} = render(
amisRender(
{
type: 'tabs',
2019-07-04 16:24:13 +08:00
tabClassName: 'bg-info',
tabs: [
{
title: '基本配置',
body: '<p>tab1 内容</p>'
},
{
title: '其他配置',
controls: [
{
name: 'c',
type: 'text',
label: '文本3'
},
{
name: 'd',
type: 'text',
label: '文本4'
}
]
}
2019-07-04 16:24:13 +08:00
]
},
{},
makeEnv()
)
);
expect(container).toMatchSnapshot();
});