diff --git a/components/tour/__tests__/index.test.tsx b/components/tour/__tests__/index.test.tsx index ebaf3795e9..a47f263bf4 100644 --- a/components/tour/__tests__/index.test.tsx +++ b/components/tour/__tests__/index.test.tsx @@ -176,7 +176,7 @@ describe('Tour', () => { }; const { getByText, container } = render(); expect(getByText('primary description.')).toBeTruthy(); - expect(document.querySelector('.ant-tour')).toHaveClass('ant-tour-primary'); + expect(container.querySelector('.ant-tour')).toHaveClass('ant-tour-primary'); expect(container.firstChild).toMatchSnapshot(); }); @@ -251,7 +251,7 @@ describe('Tour', () => { fireEvent.click(screen.getByRole('button', { name: 'Next' })); expect(getByText('Adjust Placement')).toBeTruthy(); fireEvent.click(screen.getByRole('button', { name: 'Finish' })); - expect(document.querySelector('.rc-tour')).toBeFalsy(); + expect(container.querySelector('.ant-tour')).toBeFalsy(); expect(container.firstChild).toMatchSnapshot(); }); }); diff --git a/components/tour/panelRender.tsx b/components/tour/panelRender.tsx index e0fe53e4ff..104f11aebc 100644 --- a/components/tour/panelRender.tsx +++ b/components/tour/panelRender.tsx @@ -38,9 +38,10 @@ const panelRender: ( }; const nextBtnClick = () => { - onNext?.(); if (isLastStep) { onFinish?.(); + } else { + onNext?.(); } if (typeof nextButtonProps?.onClick === 'function') { nextButtonProps?.onClick(); diff --git a/package.json b/package.json index 7955288ecf..8b46ef2f3e 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "@ant-design/react-slick": "~0.29.1", "@babel/runtime": "^7.18.3", "@ctrl/tinycolor": "^3.4.0", - "@rc-component/tour": "~1.0.0-9", + "@rc-component/tour": "~1.0.0", "classnames": "^2.2.6", "copy-to-clipboard": "^3.2.0", "dayjs": "^1.11.1",