@@ -51,7 +51,7 @@ describe('Form.List', () => {
5151 } ,
5252 ) ;
5353
54- function matchKey ( index , key ) {
54+ function matchKey ( index : number , key : React . Key ) {
5555 expect ( getList ( ) . find ( Field ) . at ( index ) . key ( ) ) . toEqual ( key ) ;
5656 }
5757
@@ -89,7 +89,7 @@ describe('Form.List', () => {
8989 } ) ;
9090
9191 it ( 'operation' , async ( ) => {
92- let operation ;
92+ let operation : ListOperations ;
9393 const [ wrapper , getList ] = generateForm ( ( fields , opt ) => {
9494 operation = opt ;
9595 return (
@@ -103,7 +103,7 @@ describe('Form.List', () => {
103103 ) ;
104104 } ) ;
105105
106- function matchKey ( index , key ) {
106+ function matchKey ( index : number , key : React . Key ) {
107107 expect ( getList ( ) . find ( Field ) . at ( index ) . key ( ) ) . toEqual ( key ) ;
108108 }
109109
@@ -232,7 +232,7 @@ describe('Form.List', () => {
232232 } ) ;
233233
234234 it ( 'remove when the param is Array' , ( ) => {
235- let operation ;
235+ let operation : ListOperations ;
236236 const [ wrapper , getList ] = generateForm ( ( fields , opt ) => {
237237 operation = opt ;
238238 return (
@@ -246,7 +246,7 @@ describe('Form.List', () => {
246246 ) ;
247247 } ) ;
248248
249- function matchKey ( index , key ) {
249+ function matchKey ( index : number , key : React . Key ) {
250250 expect ( getList ( ) . find ( Field ) . at ( index ) . key ( ) ) . toEqual ( key ) ;
251251 }
252252
@@ -310,7 +310,7 @@ describe('Form.List', () => {
310310 } ) ;
311311
312312 it ( 'add when the second param is number' , ( ) => {
313- let operation ;
313+ let operation : ListOperations ;
314314 const errorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
315315 const [ wrapper , getList ] = generateForm ( ( fields , opt ) => {
316316 operation = opt ;
@@ -523,7 +523,7 @@ describe('Form.List', () => {
523523
524524 // https://github.com/ant-design/ant-design/issues/25584
525525 it ( 'preserve should not break list' , async ( ) => {
526- let operation ;
526+ let operation : ListOperations ;
527527 const [ wrapper ] = generateForm (
528528 ( fields , opt ) => {
529529 operation = opt ;
@@ -563,9 +563,9 @@ describe('Form.List', () => {
563563 } ) ;
564564
565565 it ( 'list support validator' , async ( ) => {
566- let operation ;
567- let currentMeta ;
568- let currentValue ;
566+ let operation : ListOperations ;
567+ let currentMeta : Meta ;
568+ let currentValue : any ;
569569
570570 const [ wrapper ] = generateForm (
571571 ( _ , opt , meta ) => {
@@ -647,12 +647,19 @@ describe('Form.List', () => {
647647 expect ( formRef . current ?. isFieldsTouched ( [ 'user' ] , false ) ) . toBeFalsy ( ) ;
648648 expect ( formRef . current ?. isFieldsTouched ( [ 'user' ] , true ) ) . toBeFalsy ( ) ;
649649
650+ // console.log(wrapper.html());
651+
650652 // Changed
651653 wrapper
652654 . find ( 'input' )
653655 . first ( )
654656 . simulate ( 'change' , { target : { value : '' } } ) ;
655657
658+ // wrapper.update();
659+
660+ // console.log(wrapper.html());
661+ // expect(wrapper.html()).toMatchSnapshot();
662+
656663 expect ( formRef . current ?. isFieldTouched ( 'user' ) ) . toBeTruthy ( ) ;
657664 expect ( formRef . current ?. isFieldsTouched ( [ 'user' ] , false ) ) . toBeTruthy ( ) ;
658665 expect ( formRef . current ?. isFieldsTouched ( [ 'user' ] , true ) ) . toBeTruthy ( ) ;
0 commit comments