(null);
+
+ return (
+
+
+
+
+ button1Ref.current,
+ },
+ {
+ title: 'step 2',
+ description: 'description 2',
+ target: () => button2Ref.current,
+ },
+ {
+ title: 'step 3',
+ description: 'description 3',
+ target: () => button3Ref.current,
+ },
+ ]}
+ />
+
+ );
+ };
+
+ render();
+ await act(() => {
+ jest.runAllTimers();
+ });
+
+ // gap [10, 15] -> width: 230 + 20 = 250, height: 180 + 30 = 210
+ let targetRect = document
+ .getElementById('rc-tour-mask-test-id')
+ .querySelectorAll('rect')[1];
+ expect(targetRect).toHaveAttribute('width', '250');
+ expect(targetRect).toHaveAttribute('height', '210');
+
+ fireEvent.click(screen.getByRole('button', { name: 'Next' }));
+ await act(() => {
+ jest.runAllTimers();
+ });
+
+ // gap [20, 25] -> width: 230 + 40 = 270, height: 180 + 50 = 230
+ targetRect = document
+ .getElementById('rc-tour-mask-test-id')
+ .querySelectorAll('rect')[1];
+ expect(targetRect).toHaveAttribute('width', '270');
+ expect(targetRect).toHaveAttribute('height', '230');
+
+ fireEvent.click(screen.getByRole('button', { name: 'Next' }));
+ await act(() => {
+ jest.runAllTimers();
+ });
+
+ // gap [30, 35] -> width: 230 + 60 = 290, height: 180 + 70 = 250
+ targetRect = document
+ .getElementById('rc-tour-mask-test-id')
+ .querySelectorAll('rect')[1];
+ expect(targetRect).toHaveAttribute('width', '290');
+ expect(targetRect).toHaveAttribute('height', '250');
+ });
});