test: fix Modal.confirm test coverage to 100% (#41182)

* test: fix modal test cov

* test: fix modal test cov

* test: fix test case
This commit is contained in:
afc163 2023-03-13 19:55:59 +08:00 committed by GitHub
parent a6b07948a7
commit c0d275b4ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -106,9 +106,7 @@ export function ConfirmContent(
)}
<div className={`${confirmPrefixCls}-content`}>{props.content}</div>
</div>
{footer !== undefined ? (
footer
) : (
{footer === undefined ? (
<div className={`${confirmPrefixCls}-btns`}>
{cancelButton}
<ActionButton
@ -122,6 +120,8 @@ export function ConfirmContent(
{okText || (mergedOkCancel ? mergedLocale?.okText : mergedLocale?.justOkText)}
</ActionButton>
</div>
) : (
footer
)}
</div>
);

View File

@ -182,6 +182,7 @@ const Modal: React.FC<ModalProps> = (props) => {
visible,
width = 520,
footer,
...restProps
} = props;
@ -210,11 +211,7 @@ const Modal: React.FC<ModalProps> = (props) => {
rootClassName={classNames(hashId, rootClassName)}
wrapClassName={wrapClassNameExtended}
footer={
props.footer === null ? (
props.footer
) : (
<Footer {...props} onOk={handleOk} onCancel={handleCancel} />
)
footer === null ? footer : <Footer {...props} onOk={handleOk} onCancel={handleCancel} />
}
visible={open ?? visible}
mousePosition={restProps.mousePosition ?? mousePosition}

View File

@ -119,7 +119,7 @@ const PurePanel: React.FC<PurePanelProps> = (props) => {
additionalProps = {
closable: closable ?? true,
title,
footer: props.footer === null ? props.footer : <Footer {...props} />,
footer: <Footer {...props} />,
children,
};
}