From 8524885cfb03b119700e118cf26caf291d3641d9 Mon Sep 17 00:00:00 2001 From: pointhalo Date: Thu, 20 Jun 2024 11:50:16 +0800 Subject: [PATCH] test: add test case of form --- .../form/_story/ArrayField/remountInit.jsx | 55 +++++++++++++++++++ packages/semi-ui/form/_story/form.stories.jsx | 1 + 2 files changed, 56 insertions(+) create mode 100644 packages/semi-ui/form/_story/ArrayField/remountInit.jsx diff --git a/packages/semi-ui/form/_story/ArrayField/remountInit.jsx b/packages/semi-ui/form/_story/ArrayField/remountInit.jsx new file mode 100644 index 0000000000..838d5887aa --- /dev/null +++ b/packages/semi-ui/form/_story/ArrayField/remountInit.jsx @@ -0,0 +1,55 @@ +import React, { useState } from 'react'; +import { ArrayField, TextArea, Form, Button, useFormState } from '@douyinfe/semi-ui'; +import { IconPlusCircle, IconMinusCircle } from '@douyinfe/semi-icons'; + +// toggle form input visible +// visible -> invisible -> visible +// initValue will not use in final round now +// The behavior in ArrayField is inconsistent with that in non-ArrayField, which is undefined behavior. Clearer guidance is needed. + +const RemountInit = () => { + const [data, setData] = useState([ + { name: 'arrayfield defualtValue' }, + ]); + const [visible, setVisible] = useState(true); + const ComponentUsingFormState = () => { + const formState = useFormState(); + return ( +