mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 12:29:24 +08:00
* chore: 条形码使用 img 方便右键复制 Closes #3716 * 更新 snapshot * 修类型报错
This commit is contained in:
parent
838d741764
commit
d6159768eb
@ -83,7 +83,7 @@ test('factory load Renderer on need', async () => {
|
||||
session: 'loadRenderer',
|
||||
loadRenderer: schema => {
|
||||
interface MyProps extends RendererProps {
|
||||
a: number;
|
||||
a?: number;
|
||||
}
|
||||
|
||||
class MyComponent extends React.Component<MyProps> {
|
||||
@ -106,7 +106,7 @@ test('factory load Renderer on need', async () => {
|
||||
|
||||
test('factory:registerRenderer', () => {
|
||||
interface MyProps extends RendererProps {
|
||||
a: number;
|
||||
a?: number;
|
||||
}
|
||||
|
||||
class MyComponent extends React.Component<MyProps> {
|
||||
|
@ -2,10 +2,10 @@ import React = require('react');
|
||||
import {render, fireEvent} from '@testing-library/react';
|
||||
import '../../src/themes/default';
|
||||
import {render as amisRender} from '../../src/index';
|
||||
import {makeEnv} from '../helper';
|
||||
import {makeEnv, wait} from '../helper';
|
||||
import 'jest-canvas-mock';
|
||||
|
||||
test('Renderer:bar-code', () => {
|
||||
test('Renderer:bar-code', async () => {
|
||||
const {container} = render(
|
||||
amisRender(
|
||||
{
|
||||
@ -19,6 +19,7 @@ test('Renderer:bar-code', () => {
|
||||
makeEnv({})
|
||||
)
|
||||
);
|
||||
await wait(500);
|
||||
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
@ -16,10 +16,11 @@ exports[`Renderer:bar-code 1`] = `
|
||||
>
|
||||
<div
|
||||
class="cxd-BarCode"
|
||||
style="display: none;"
|
||||
/>
|
||||
<div>
|
||||
...
|
||||
style=""
|
||||
>
|
||||
<img
|
||||
src="data:image/png;base64,00"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
.#{$ns}BarCode {
|
||||
> svg {
|
||||
> img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export class BarCode extends React.Component<BarCodeProps> {
|
||||
|
||||
constructor(props: BarCodeProps) {
|
||||
super(props);
|
||||
this.dom = React.createRef<SVGSVGElement>();
|
||||
this.dom = React.createRef<HTMLImageElement>();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: BarCodeProps) {
|
||||
@ -43,7 +43,7 @@ export class BarCode extends React.Component<BarCodeProps> {
|
||||
}
|
||||
|
||||
render() {
|
||||
return <svg ref={this.dom}></svg>;
|
||||
return <img ref={this.dom} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user