Skip to content

Commit

Permalink
test: solve test cov (#48611)
Browse files Browse the repository at this point in the history
* test: solve test cov

* test: solve test cov
  • Loading branch information
li-jia-nan committed Apr 25, 2024
1 parent 9acde83 commit cc51d06
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions components/typography/Base/CopyBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@ export interface CopyBtnProps extends Omit<CopyConfig, 'onCopy'> {
}

const CopyBtn: React.FC<CopyBtnProps> = (props) => {
const { prefixCls, copied, locale = {}, onCopy, iconOnly, tooltips, icon, loading } = props;
const {
prefixCls,
copied,
locale,
iconOnly,
tooltips,
icon,
loading: btnLoading,
tabIndex,
onCopy,
} = props;

const tooltipNodes = toList(tooltips);
const iconNodes = toList(icon);

const { copied: copiedText, copy: copyText } = locale;
const { copied: copiedText, copy: copyText } = locale ?? {};

const copyTitle = copied
? getNode(tooltipNodes[1], copiedText)
Expand All @@ -42,11 +52,11 @@ const CopyBtn: React.FC<CopyBtnProps> = (props) => {
})}
onClick={onCopy}
aria-label={ariaLabel}
tabIndex={props.tabIndex}
tabIndex={tabIndex}
>
{copied
? getNode(iconNodes[1], <CheckOutlined />, true)
: getNode(iconNodes[0], loading ? <LoadingOutlined /> : <CopyOutlined />, true)}
: getNode(iconNodes[0], btnLoading ? <LoadingOutlined /> : <CopyOutlined />, true)}
</TransButton>
</Tooltip>
);
Expand Down

0 comments on commit cc51d06

Please sign in to comment.