mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
fix: Tour should not trigger onNext if finish (#38347)
* fix: Tour should not trigger onNext if finish * test: update test case * chore: update test case
This commit is contained in:
parent
b0850139f2
commit
abf45ca898
@ -176,7 +176,7 @@ describe('Tour', () => {
|
||||
};
|
||||
const { getByText, container } = render(<App />);
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -38,9 +38,10 @@ const panelRender: (
|
||||
};
|
||||
|
||||
const nextBtnClick = () => {
|
||||
onNext?.();
|
||||
if (isLastStep) {
|
||||
onFinish?.();
|
||||
} else {
|
||||
onNext?.();
|
||||
}
|
||||
if (typeof nextButtonProps?.onClick === 'function') {
|
||||
nextButtonProps?.onClick();
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user