amis2/__tests__/renderers/Form/number.test.tsx
liaoxuezhi 9a3d1f43c2
chore: 自动补的 input[type=submit] 放到开头, 影响原有 last-child 的 css 样式 (#2601)
* chore: 自动补的 input[type=submit] 放到开头, 影响原有 last-child 的 css 样式

* 更新 snapshot
2021-09-23 13:28:30 +08:00

40 lines
883 B
TypeScript

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';
test('Renderer:number', async () => {
const {container} = render(
amisRender(
{
type: 'form',
api: '/api/xxx',
controls: [
{
type: 'number',
name: 'a',
label: 'number',
value: '123'
}
],
title: 'The form',
actions: []
},
{},
makeEnv({})
)
);
const input = container.querySelector('input[step="1"]') as any;
expect(input?.value).toEqual('123');
fireEvent.change(input!, {
target: {
value: '456'
}
});
expect(input?.value).toEqual('456');
expect(container).toMatchSnapshot();
});