@@ -138,21 +138,43 @@ test('trigger click event on [Space] keyup on HTMLButtonElement', () => {
138138} ) 
139139
140140test ( 'trigger click event on [Space] keyup on HTMLInputElement type=button' ,  ( )  =>  { 
141-   const  { element,  getEventSnapshot,  getEvents}  =  setup ( `<button/>` ) 
141+   const  { element,  getEventSnapshot,  getEvents}  =  setup ( `<input type=" button"  />` ) 
142142  ; ( element  as  HTMLButtonElement ) . focus ( ) 
143143
144144  userEvent . keyboard ( '[Space]' ) 
145145
146146  expect ( getEvents ( 'click' ) ) . toHaveLength ( 1 ) 
147147  expect ( getEvents ( 'click' ) [ 0 ] ) . toHaveProperty ( 'detail' ,  0 ) 
148148  expect ( getEventSnapshot ( ) ) . toMatchInlineSnapshot ( ` 
149-     Events fired on: button  
149+     Events fired on: input[value=""]  
150150
151-     button - focus 
152-     button - focusin 
153-     button - keydown: (32) 
154-     button - keypress: (32) 
155-     button - keyup: (32) 
156-     button - click: Left (0) 
151+     input[value=""] - focus 
152+     input[value=""] - focusin 
153+     input[value=""] - keydown: (32) 
154+     input[value=""] - keypress: (32) 
155+     input[value=""] - keyup: (32) 
156+     input[value=""] - click: Left (0) 
157+   ` ) 
158+ } ) 
159+ 
160+ test ( 'trigger change event on [Space] keyup on HTMLInputElement type=radio' ,  ( )  =>  { 
161+   const  { element,  getEventSnapshot,  getEvents}  =  setup ( `<input type="radio" />` ) 
162+   ; ( element  as  HTMLInputElement ) . focus ( ) 
163+ 
164+   userEvent . keyboard ( '[Space]' ) 
165+ 
166+   expect ( getEvents ( 'change' ) ) . toHaveLength ( 1 ) 
167+   expect ( getEventSnapshot ( ) ) . toMatchInlineSnapshot ( ` 
168+     Events fired on: input[checked=true] 
169+ 
170+     input[checked=false] - focus 
171+     input[checked=false] - focusin 
172+     input[checked=false] - keydown: (32) 
173+     input[checked=false] - keypress: (32) 
174+     input[checked=false] - keyup: (32) 
175+     input[checked=true] - click: Left (0) 
176+       unchecked -> checked 
177+     input[checked=true] - input 
178+     input[checked=true] - change 
157179  ` ) 
158180} ) 
0 commit comments