File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,19 @@ describe('.toHaveFormValues', () => {
189189 } ) . toThrowError ( / m u s t b e o f t h e s a m e t y p e / )
190190 } )
191191
192+ it ( 'allows a checkbox and a hidden input which is a common workaround so forms can send "false" for a checkbox' , ( ) => {
193+ const { container} = render ( `
194+ <form>
195+ <input type="hidden" name="sample-checkbox" value=0>
196+ <input type="checkbox" name="sample-checkbox" value=1>
197+ </form>
198+ ` )
199+ const form = container . querySelector ( 'form' )
200+ expect ( ( ) => {
201+ expect ( form ) . toHaveFormValues ( { "sample-checkbox" : 1 } )
202+ } ) . not . toThrowError ( )
203+ } )
204+
192205 it ( 'detects multiple elements with the same type and name' , ( ) => {
193206 const { container} = render ( `
194207 <form>
You can’t perform that action at this time.
0 commit comments