mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
jest
This commit is contained in:
@@ -44,17 +44,20 @@ describe('Prevent duplicate form submissions', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("It should prevent the second click on the 'submit' button", () => {
|
test("It should prevent any clicks of the 'submit' button after the first one submitting the form", () => {
|
||||||
|
|
||||||
helpers.triggerEvent(button, 'click');
|
helpers.triggerEvent(button, 'click');
|
||||||
helpers.triggerEvent(button, 'click');
|
helpers.triggerEvent(button, 'click');
|
||||||
|
|
||||||
|
expect(formEventSpy.mock.calls.length).toEqual(1);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("It should allow clicks again after 1.5 seconds", () => {
|
test("It should allow clicks again after 1.5 seconds", () => {
|
||||||
|
|
||||||
helpers.triggerEvent(button, 'click');
|
helpers.triggerEvent(button, 'click');
|
||||||
|
|
||||||
jest.advanceTimersByTime(10000);
|
jest.advanceTimersByTime(1500);
|
||||||
|
|
||||||
helpers.triggerEvent(button, 'click');
|
helpers.triggerEvent(button, 'click');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user