jsun969 / react-hook-form-antd

๐Ÿ“‹๐Ÿœ Master your Ant Design form with React Hook Form! ็”จ React Hook Form ๆ‹ฟๆไฝ ็š„ Ant Design ่กจๅ•๏ผ
https://npm.im/react-hook-form-antd
MIT License
58 stars 10 forks source link

Add tests instead of example #64

Closed jsun969 closed 9 months ago

jsun969 commented 9 months ago

@jakub-szewczyk I removed example and add tests. But I found that reset is still not working. Did it work in your PR? Would you like help me to fix this problem? Thx a lot!

https://github.com/jsun969/react-hook-form-antd/blob/d84827e6822eaea6a7c90b75bba4d3a18bc031a2/__tests__/Form.test.tsx#L52-L63

jakub-szewczyk commented 9 months ago

@jsun969 Yeah it worked in the provided example and it still actually works as expected when I'm testing it manually. It doesn't seem to be working in the test you wrote though. I played around with the test a little but can't figure why it ain't working.

jsun969 commented 9 months ago

@jakub-szewczyk That seems weird. I add name and default value in source code in this PR (antd need name to generate the htmlFor for form field label). Can this be the problem? https://github.com/jsun969/react-hook-form-antd/blob/d3b8e2e28f3f7103877ca35cfc50c89a2e23b05d/src/FormItem.tsx#L31-L33

I'll try to figure out why before releasing this PR. Thx for your reply!

jakub-szewczyk commented 9 months ago

@jsun969 I don't think the name prop is a problem.