File tree Expand file tree Collapse file tree
manage_breast_screening/assets/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { waitFor } from '@testing-library/dom'
2+
3+ import { initCheckIn } from './check-in.js'
4+
5+ jest . mock ( './check-in.js' )
6+
7+ describe ( 'Automatic initialisation' , ( ) => {
8+ it ( 'should init components on DOMContentLoaded' , async ( ) => {
9+ await import ( './index.js' )
10+
11+ // Should not initialise on import
12+ expect ( initCheckIn ) . not . toHaveBeenCalled ( )
13+
14+ // Should initialise on DOMContentLoaded
15+ window . document . dispatchEvent ( new Event ( 'DOMContentLoaded' ) )
16+ await waitFor ( ( ) => expect ( initCheckIn ) . toHaveBeenCalled ( ) )
17+ } )
18+ } )
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { userEvent } from '@testing-library/user-event'
33
44import setSubmit from './set-submit.js'
55
6- describe ( 'setSubmit ' , ( ) => {
6+ describe ( 'Set submit events ' , ( ) => {
77 const user = userEvent . setup ( )
88
99 /** @type {HTMLButtonElement } */
You can’t perform that action at this time.
0 commit comments