- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.6k
Closed
Labels
Description
Version
30.0.3
jest-environment-jsdom: 30.0.2
jsdom: 26.1.0
Steps to reproduce
The following test worked on Jest 29, but breaks on Jest 30. For some reason the submit callback is not being triggered. We see the same issue with .click() calls.
const myForm = document.querySelector('form');
const cb = jest.fn();
myForm.addEventListener('submit', cb);
myForm.submit();
expect(cb).toHaveBeenCalled();Expected behavior
Calling submit() on a form element should trigger any submit callbacks.
Actual behavior
The callback does not get triggered.
Additional context
Calling dispatchEvent does trigger the callback for submit, but this does not work for click.
myForm.dispatchEvent(new Event('submit', { bubbles: true }));Environment
System:
    OS: Linux 6.8 Linux Mint 22.1 (Xia)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz
  Binaries:
    Node: 22.16.0 - ~/.local/share/mise/installs/node/22.16.0/bin/node
    Yarn: 1.22.10 - ~/.local/share/mise/installs/yarn/1.22.10/bin/yarn
    npm: 10.9.2 - ~/.local/share/mise/installs/node/22.16.0/bin/npm
    pnpm: 10.12.3 - ~/.local/share/mise/installs/pnpm/10.12.3/pnpm
  npmPackages:
    jest: ^30.0.3 => 30.0.3