Skip to content

Commit

Permalink
fix(components/input-popover): 修复 disabled 不会影响 Popover 的 disabled 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxinssfd committed Jan 16, 2024
1 parent 5a2246b commit 62e8d82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/components/src/input-popover/InputPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export const InputPopover: React.FC<InputPopoverProps> = React.forwardRef<
on={(...args) => (popoverOn(...args), popoverProps.on?.(...args))}
widthByTrigger={popoverProps.widthByTrigger ?? true}
placement={popoverProps.placement || 'bottom'}
disabled={popoverProps.disabled ?? disabled}
visibleControllerRef={visibleControllerRef}
trigger={popoverProps.trigger ?? 'click'}
visible={visible}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,15 @@ describe('InputPopover', () => {
expect(getBalloon()).not.toHaveClass(cls.leaveActive);
expect(getBalloon()).not.toHaveClass(cls.invisible);
});

it('disabled 必须影响 Popover', () => {
jest.useFakeTimers();
const { container } = render(<InputPopover disabled />);
expect(document.querySelector('.t-word-balloon')).toBeNull();

fireEvent.click(container.firstChild!);

act(() => jest.advanceTimersByTime(1));
expect(document.querySelector('.t-word-balloon')).toBeNull();
});
});

0 comments on commit 62e8d82

Please sign in to comment.