mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 13:38:56 +08:00
71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
/**
|
||
* 组件名称:Image/Images 图片/图片集
|
||
* 单测内容:
|
||
* 1. Image图片
|
||
* 2. Images图片集
|
||
*/
|
||
|
||
import {render} from '@testing-library/react';
|
||
import '../../src';
|
||
import {render as amisRender} from '../../src';
|
||
import {makeEnv} from '../helper';
|
||
|
||
describe('Renderer:image', () => {
|
||
test('image:basic', async () => {
|
||
const {container} = render(
|
||
amisRender(
|
||
{
|
||
type: 'image',
|
||
defaultImage: 'https://www.baidu.com/img/bd_logo1.png',
|
||
title: '图片',
|
||
description: '图片描述',
|
||
imageClassName: 'b',
|
||
className: 'show'
|
||
},
|
||
{},
|
||
makeEnv({})
|
||
)
|
||
);
|
||
|
||
expect(container).toMatchSnapshot();
|
||
});
|
||
});
|
||
|
||
describe('Renderer:images', () => {
|
||
test('images:basic', async () => {
|
||
const {container} = render(
|
||
amisRender(
|
||
{
|
||
type: 'page',
|
||
data: {
|
||
imageList: [
|
||
'https://internal-amis-res.cdn.bcebos.com/images/2020-1/1578395692722/4f3cb4202335.jpeg@s_0,w_216,l_1,f_jpg,q_80',
|
||
'https://internal-amis-res.cdn.bcebos.com/images/2020-1/1578395692942/d8e4992057f9.jpeg@s_0,w_216,l_1,f_jpg,q_80',
|
||
'https://internal-amis-res.cdn.bcebos.com/images/2020-1/1578395693148/1314a2a3d3f6.jpeg@s_0,w_216,l_1,f_jpg,q_80',
|
||
'https://internal-amis-res.cdn.bcebos.com/images/2020-1/1578395693379/8f2e79f82be0.jpeg@s_0,w_216,l_1,f_jpg,q_80',
|
||
'https://internal-amis-res.cdn.bcebos.com/images/2020-1/1578395693566/552b175ef11d.jpeg@s_0,w_216,l_1,f_jpg,q_80'
|
||
]
|
||
},
|
||
body: [
|
||
{
|
||
type: 'images',
|
||
source: '${imageList}'
|
||
},
|
||
{
|
||
type: 'divider'
|
||
},
|
||
{
|
||
type: 'images',
|
||
name: 'imageList'
|
||
}
|
||
]
|
||
},
|
||
{},
|
||
makeEnv({})
|
||
)
|
||
);
|
||
|
||
expect(container).toMatchSnapshot();
|
||
});
|
||
});
|