2019-06-18 09:50:05 +08:00
|
|
|
import React = require('react');
|
2021-06-03 13:05:35 +08:00
|
|
|
import {render, fireEvent} from '@testing-library/react';
|
2022-06-02 10:00:09 +08:00
|
|
|
import '../../../src';
|
|
|
|
import {render as amisRender} from '../../../src';
|
2023-07-05 14:41:10 +08:00
|
|
|
import {makeEnv, replaceReactAriaIds} from '../../helper';
|
2019-06-18 09:50:05 +08:00
|
|
|
|
|
|
|
test('Renderer:repeat', async () => {
|
2021-06-03 13:05:35 +08:00
|
|
|
const {container, getByText} = render(
|
|
|
|
amisRender(
|
|
|
|
{
|
2019-06-18 09:50:05 +08:00
|
|
|
type: 'form',
|
|
|
|
api: '/api/xxx',
|
|
|
|
controls: [
|
2021-06-03 13:05:35 +08:00
|
|
|
{
|
|
|
|
type: 'repeat',
|
|
|
|
name: 'a',
|
|
|
|
label: 'repeat',
|
|
|
|
options:
|
|
|
|
'secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly'
|
|
|
|
}
|
2019-06-18 09:50:05 +08:00
|
|
|
],
|
|
|
|
title: 'The form',
|
|
|
|
actions: []
|
2021-06-03 13:05:35 +08:00
|
|
|
},
|
|
|
|
{},
|
|
|
|
makeEnv({})
|
|
|
|
)
|
|
|
|
);
|
2019-06-18 09:50:05 +08:00
|
|
|
|
2021-06-03 13:05:35 +08:00
|
|
|
fireEvent.click(getByText('不重复'));
|
|
|
|
fireEvent.click(getByText('秒'));
|
|
|
|
fireEvent.click(getByText('秒'));
|
|
|
|
fireEvent.click(getByText('时'));
|
|
|
|
fireEvent.click(getByText('时'));
|
|
|
|
fireEvent.click(getByText('分'));
|
|
|
|
fireEvent.click(getByText('分'));
|
|
|
|
fireEvent.click(getByText('天'));
|
|
|
|
fireEvent.click(getByText('天'));
|
|
|
|
fireEvent.click(getByText('周中'));
|
|
|
|
fireEvent.click(getByText('周中'));
|
|
|
|
fireEvent.click(getByText('周'));
|
|
|
|
fireEvent.click(getByText('周'));
|
|
|
|
fireEvent.click(getByText('月'));
|
|
|
|
fireEvent.click(getByText('月'));
|
|
|
|
fireEvent.click(getByText('年'));
|
|
|
|
fireEvent.click(getByText('年'));
|
2019-06-18 09:50:05 +08:00
|
|
|
|
2023-07-05 14:41:10 +08:00
|
|
|
replaceReactAriaIds(container);
|
2021-06-03 13:05:35 +08:00
|
|
|
expect(container).toMatchSnapshot();
|
|
|
|
});
|