Skip to content

Commit

Permalink
Merge pull request #413 from actiontech/test/push-rule-unit-tests-2
Browse files Browse the repository at this point in the history
[test]:(SqlManagementIssuePush) Add unit tests
  • Loading branch information
anny1021 authored Sep 3, 2024
2 parents 674263e + e6e9feb commit 4ea920a
Show file tree
Hide file tree
Showing 14 changed files with 3,858 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ exports[`base/System/components/ConfigSwitch render snap when switch disabled 1`
type="button"
>
<span>
OK
确 认
</span>
</button>
</div>
Expand Down Expand Up @@ -261,7 +261,7 @@ exports[`base/System/components/ConfigSwitch render snap when title is false 1`]
type="button"
>
<span>
OK
确 认
</span>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ describe('base/System/components/ConfigSwitch', () => {
popoverVisible: true
});
expect(screen.getByText('是否确认关闭当前配置?')).toBeInTheDocument();
expect(screen.getByText('OK')).toBeInTheDocument();
fireEvent.click(screen.getByText('OK'));
expect(screen.getByText('确 认')).toBeInTheDocument();
fireEvent.click(screen.getByText('确 认'));
await act(async () => jest.advanceTimersByTime(500));
expect(onConfirmFn).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FormItemLabel } from '../../../FormCom';
import { BasicSwitch } from '../../../..';
import { IBasicSwitch } from '../../../BasicSwitch';
import classNames from 'classnames';
import { useTranslation } from 'react-i18next';

export interface ConfigSwitchParams extends Omit<IBasicSwitch, 'onChange'> {
title: string;
Expand All @@ -24,12 +25,14 @@ const ConfigSwitch: React.FC<ConfigSwitchParams> = ({
onSwitchPopoverOpen,
...switchProps
}) => {
const { t } = useTranslation();
return (
<Popconfirm
title={title}
open={popoverVisible}
onOpenChange={onSwitchPopoverOpen}
onConfirm={onConfirm}
okText={t('common.ok')}
>
<FormItemLabel name={switchFieldName} valuePropName="checked">
<BasicSwitch
Expand Down
Loading

0 comments on commit 4ea920a

Please sign in to comment.