2022-02-10 20:15:39 +08:00
|
|
|
import React = require('react');
|
2022-04-12 14:22:39 +08:00
|
|
|
import {render, fireEvent, waitFor} from '@testing-library/react';
|
2022-02-10 20:15:39 +08:00
|
|
|
import '../../src/themes/default';
|
|
|
|
import {render as amisRender} from '../../src/index';
|
2022-03-09 20:03:08 +08:00
|
|
|
import {makeEnv, wait} from '../helper';
|
2022-02-10 20:15:39 +08:00
|
|
|
import 'jest-canvas-mock';
|
|
|
|
|
2022-03-09 20:03:08 +08:00
|
|
|
test('Renderer:bar-code', async () => {
|
2022-04-12 14:22:39 +08:00
|
|
|
const {container, getByTestId} = render(
|
2022-02-10 20:15:39 +08:00
|
|
|
amisRender(
|
|
|
|
{
|
|
|
|
type: 'page',
|
|
|
|
body: {
|
|
|
|
type: 'barcode',
|
|
|
|
value: 'amis'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
makeEnv({})
|
|
|
|
)
|
|
|
|
);
|
2022-04-12 14:22:39 +08:00
|
|
|
await waitFor(() => expect(getByTestId('barcode')).toBeInTheDocument());
|
2022-02-10 20:15:39 +08:00
|
|
|
|
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|