amis2/packages/amis/__tests__/renderers/Mapping.test.tsx
2022-06-02 10:00:09 +08:00

27 lines
709 B
TypeScript

import React = require('react');
import {render} from '@testing-library/react';
import '../../src';
import {render as amisRender} from '../../src';
import {makeEnv} from '../helper';
test('Renderer:mapping', async () => {
const {container} = render(
amisRender(
{
type: 'mapping',
mapping: {
1: "<span class='label label-info'>漂亮</span>",
2: "<span class='label label-success'>开心</span>",
3: "<span class='label label-danger'>惊吓</span>",
4: "<span class='label label-warning'>紧张</span>",
'*': '其他:${type}'
}
},
{},
makeEnv({})
)
);
expect(container).toMatchSnapshot();
});