Browse Source

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

* test: fix modal test cov

* test: fix modal test cov

* test: fix test case
pull/41205/head
afc163 2 years ago
committed by GitHub
parent
commit
c0d275b4ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      components/modal/ConfirmDialog.tsx
  2. 7
      components/modal/Modal.tsx
  3. 2
      components/modal/PurePanel.tsx

6
components/modal/ConfirmDialog.tsx

@ -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>
);

7
components/modal/Modal.tsx

@ -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}

2
components/modal/PurePanel.tsx

@ -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,
};
}

Loading…
Cancel
Save