fix: keep preview retry controls stationary during pointer activation
This commit is contained in:
@@ -701,6 +701,26 @@ test('profile-backed sections expand, reorder, hide and persist variant-only ove
|
||||
expect(await screen.findByText('Saved')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('focusing a preview retry control keeps its pointer target stationary', async () => {
|
||||
routeGet(() => Promise.resolve({ data: variant } as any));
|
||||
mockedApi.post.mockRejectedValueOnce(new Error('preview offline'));
|
||||
renderAt(3);
|
||||
const retry = await screen.findByRole('button', { name: 'Retry preview' });
|
||||
const region = screen.getByRole('region', { name: 'Live preview' });
|
||||
const scroll = jest.fn();
|
||||
region.parentElement!.scrollIntoView = scroll;
|
||||
await act(async () => {
|
||||
retry.focus();
|
||||
await new Promise<void>(resolve => requestAnimationFrame(() => resolve()));
|
||||
});
|
||||
expect(scroll).not.toHaveBeenCalled();
|
||||
await act(async () => {
|
||||
region.focus();
|
||||
await new Promise<void>(resolve => requestAnimationFrame(() => resolve()));
|
||||
});
|
||||
expect(scroll).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('preview failure is visible and retryable without leaving the editor', async () => {
|
||||
routeGet(() => Promise.resolve({ data: variant } as any));
|
||||
mockedApi.post.mockRejectedValueOnce(new Error('preview offline')).mockResolvedValueOnce({ data: { themeId: 'modern', html: '<p>retry</p>', suggestedFileName: 'cv.pdf' } } as any);
|
||||
|
||||
Reference in New Issue
Block a user