Skip to content

Commit

Permalink
feat: remove *-show-arrow cls when showArrow is true (#433)
Browse files Browse the repository at this point in the history
* feat: remove *-show-arrow cls when showArrow is true

* feat: update test case
  • Loading branch information
kiner-tang authored Jan 18, 2023
1 parent bf78c2e commit 2b86fce
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 1 addition & 4 deletions src/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { TriggerProps } from 'rc-trigger';
import type { AlignType, AnimationType, ActionType } from 'rc-trigger/lib/interface';
import { placements } from './placements';
import Popup from './Popup';
import classNames from 'classnames';

export interface TooltipProps extends Pick<TriggerProps, 'onPopupAlign' | 'builtinPlacements'> {
trigger?: ActionType | ActionType[];
Expand Down Expand Up @@ -102,9 +101,7 @@ const Tooltip = (props: TooltipProps, ref) => {

return (
<Trigger
popupClassName={classNames(overlayClassName, {
[`${prefixCls}-show-arrow`]: showArrow,
})}
popupClassName={overlayClassName}
prefixCls={prefixCls}
popup={getPopupElement}
action={trigger}
Expand Down
2 changes: 0 additions & 2 deletions tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ describe('rc-tooltip', () => {
</Tooltip>,
);
fireEvent.click(container.querySelector('.target'));
expect(container.querySelector('.rc-tooltip').classList).toContain('rc-tooltip-show-arrow');
expect(container.querySelector('.rc-tooltip-content').outerHTML).toBe(
'<div class="rc-tooltip-content"><div class="rc-tooltip-arrow"></div><div class="rc-tooltip-inner" role="tooltip"><strong class="x-content">Tooltip content</strong></div></div>',
);
Expand All @@ -192,7 +191,6 @@ describe('rc-tooltip', () => {
</Tooltip>,
);
fireEvent.click(container.querySelector('.target'));
expect(container.querySelector('.rc-tooltip').classList).toContain('rc-tooltip-show-arrow');
expect(container.querySelector('.rc-tooltip-content').outerHTML).toBe(
'<div class="rc-tooltip-content"><div class="rc-tooltip-arrow"></div><div class="rc-tooltip-inner" role="tooltip"><strong class="x-content">Tooltip content</strong></div></div>',
);
Expand Down

0 comments on commit 2b86fce

Please sign in to comment.