Fix admin modals getting stuck after a successful submit
This commit is contained in:
@@ -61,4 +61,25 @@ describe('users admin page', () => {
|
||||
await expect.element(page.getByRole('button', { name: 'Save User' })).toBeInTheDocument();
|
||||
expect(page.getByText('User updated').elements()).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('closes the create modal after a successful submit', async () => {
|
||||
const result = render(Page, {
|
||||
params: {},
|
||||
data: makeData(),
|
||||
form: null
|
||||
});
|
||||
|
||||
await clickButton('New User');
|
||||
await expect.element(page.getByRole('button', { name: 'Create User' })).toBeInTheDocument();
|
||||
|
||||
await result.rerender({ form: { success: true, action: 'upsert' } });
|
||||
|
||||
await expect.element(page.getByText('User created')).toBeInTheDocument();
|
||||
await vi.waitFor(
|
||||
() => {
|
||||
expect(page.getByRole('button', { name: 'Create User' }).elements()).toHaveLength(0);
|
||||
},
|
||||
{ timeout: 3000 }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user