Skip to content

Commit cb61b22

Browse files
author
刘欢
committed
fix: remove unnecessary props from Dialog component in tests
1 parent 30d296d commit cb61b22

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/DialogWrap.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const DialogWrap: React.FC<IDialogPropTypes> = (props) => {
2626
scrollLock = true,
2727
onClose,
2828
} = props;
29+
const { scrollLock: _, ...restProps } = props;
2930
const [animatedVisible, setAnimatedVisible] = React.useState<boolean>(visible);
3031

3132
const refContext = React.useMemo(() => ({ panel: panelRef }), [panelRef]);
@@ -59,7 +60,7 @@ const DialogWrap: React.FC<IDialogPropTypes> = (props) => {
5960
autoLock={scrollLock && (visible || animatedVisible)}
6061
>
6162
<Dialog
62-
{...props}
63+
{...restProps}
6364
destroyOnHidden={destroyOnHidden}
6465
afterClose={() => {
6566
const closableObj = closable && typeof closable === 'object' ? closable : {};

tests/scroll.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('Dialog.Scroll', () => {
8080
});
8181

8282
it('should not lock body scroll when scrollLock is false', () => {
83-
const { unmount, rerender } = render(<Dialog visible scrollLock={false} />);
83+
const { unmount } = render(<Dialog visible scrollLock={false} />);
8484

8585
// body should not have overflow:hidden when scrollLock is false
8686
expect(document.body).not.toHaveStyle({
@@ -91,7 +91,7 @@ describe('Dialog.Scroll', () => {
9191
});
9292

9393
it('should lock body scroll when scrollLock is true (default)', () => {
94-
const { unmount, rerender } = render(<Dialog visible scrollLock={true} />);
94+
const { unmount } = render(<Dialog visible scrollLock={true} />);
9595
expect(document.body).toHaveStyle({
9696
overflowY: 'hidden',
9797
});

0 commit comments

Comments
 (0)