This commit is contained in:
Beverly Nguyen
2025-03-14 13:56:48 -07:00
parent 10fb9f9b35
commit fab1ef6d45

View File

@@ -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');
expect(formEventSpy.mock.calls.length).toEqual(1);
});
test("It should allow clicks again after 1.5 seconds", () => {
helpers.triggerEvent(button, 'click');
jest.advanceTimersByTime(10000);
jest.advanceTimersByTime(1500);
helpers.triggerEvent(button, 'click');