Skip to content

Commit 3d85648

Browse files
committed
test: add test cases for checkbox, radio, and select widgets with descriptions
1 parent 974781a commit 3d85648

File tree

12 files changed

+15327
-8470
lines changed

12 files changed

+15327
-8470
lines changed

packages/antd/test/__snapshots__/Form.test.tsx.snap

Lines changed: 411 additions & 0 deletions
Large diffs are not rendered by default.

packages/chakra-ui/test/__snapshots__/Form.test.tsx.snap

Lines changed: 3550 additions & 1838 deletions
Large diffs are not rendered by default.

packages/core/test/__snapshots__/FormSnap.test.tsx.snap

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,56 @@ exports[`single fields checkbox field 1`] = `
21042104
</form>
21052105
`;
21062106

2107+
exports[`single fields checkbox field with description in schema and FieldTemplate 1`] = `
2108+
<form
2109+
className="rjsf"
2110+
noValidate={false}
2111+
onSubmit={[Function]}
2112+
>
2113+
<div
2114+
className="form-group rjsf-field rjsf-field-boolean"
2115+
>
2116+
<div
2117+
className="field-description"
2118+
id="root__description"
2119+
>
2120+
This is a field template description
2121+
</div>
2122+
<div
2123+
className="checkbox "
2124+
>
2125+
<label>
2126+
<input
2127+
aria-describedby="root__error root__description root__help"
2128+
autoFocus={false}
2129+
checked={false}
2130+
disabled={false}
2131+
id="root"
2132+
name="root"
2133+
onBlur={[Function]}
2134+
onChange={[Function]}
2135+
onFocus={[Function]}
2136+
required={false}
2137+
type="checkbox"
2138+
/>
2139+
<span>
2140+
test
2141+
</span>
2142+
</label>
2143+
</div>
2144+
</div>
2145+
<div>
2146+
<button
2147+
className="btn btn-info "
2148+
disabled={false}
2149+
type="submit"
2150+
>
2151+
Submit
2152+
</button>
2153+
</div>
2154+
</form>
2155+
`;
2156+
21072157
exports[`single fields checkbox field with label 1`] = `
21082158
<form
21092159
className="rjsf"
@@ -5870,6 +5920,94 @@ exports[`single fields radio field 1`] = `
58705920
</form>
58715921
`;
58725922

5923+
exports[`single fields radio widget with description in schema and FieldTemplate 1`] = `
5924+
<form
5925+
className="rjsf"
5926+
noValidate={false}
5927+
onSubmit={[Function]}
5928+
>
5929+
<div
5930+
className="form-group rjsf-field rjsf-field-boolean"
5931+
>
5932+
<label
5933+
className="control-label"
5934+
htmlFor="root"
5935+
>
5936+
test
5937+
</label>
5938+
<div
5939+
className="field-description"
5940+
id="root__description"
5941+
>
5942+
This is a field template description
5943+
</div>
5944+
<div
5945+
className="field-radio-group"
5946+
id="root"
5947+
role="radiogroup"
5948+
>
5949+
<div
5950+
className="radio "
5951+
>
5952+
<label>
5953+
<span>
5954+
<input
5955+
aria-describedby="root__error root__description root__help"
5956+
autoFocus={false}
5957+
checked={false}
5958+
disabled={false}
5959+
id="root-0"
5960+
name="root"
5961+
onBlur={[Function]}
5962+
onChange={[Function]}
5963+
onFocus={[Function]}
5964+
type="radio"
5965+
value="0"
5966+
/>
5967+
<span>
5968+
Yes
5969+
</span>
5970+
</span>
5971+
</label>
5972+
</div>
5973+
<div
5974+
className="radio "
5975+
>
5976+
<label>
5977+
<span>
5978+
<input
5979+
aria-describedby="root__error root__description root__help"
5980+
autoFocus={false}
5981+
checked={false}
5982+
disabled={false}
5983+
id="root-1"
5984+
name="root"
5985+
onBlur={[Function]}
5986+
onChange={[Function]}
5987+
onFocus={[Function]}
5988+
type="radio"
5989+
value="1"
5990+
/>
5991+
<span>
5992+
No
5993+
</span>
5994+
</span>
5995+
</label>
5996+
</div>
5997+
</div>
5998+
</div>
5999+
<div>
6000+
<button
6001+
className="btn btn-info "
6002+
disabled={false}
6003+
type="submit"
6004+
>
6005+
Submit
6006+
</button>
6007+
</div>
6008+
</form>
6009+
`;
6010+
58736011
exports[`single fields schema examples 1`] = `
58746012
<form
58756013
className="rjsf"
@@ -6667,6 +6805,68 @@ exports[`single fields select field single choice uiSchema disabled using radio
66676805
</form>
66686806
`;
66696807

6808+
exports[`single fields select widget with description in schema and FieldTemplate 1`] = `
6809+
<form
6810+
className="rjsf"
6811+
noValidate={false}
6812+
onSubmit={[Function]}
6813+
>
6814+
<div
6815+
className="form-group rjsf-field rjsf-field-boolean"
6816+
>
6817+
<label
6818+
className="control-label"
6819+
htmlFor="root"
6820+
>
6821+
test
6822+
</label>
6823+
<div
6824+
className="field-description"
6825+
id="root__description"
6826+
>
6827+
This is a field template description
6828+
</div>
6829+
<select
6830+
aria-describedby="root__error root__description root__help"
6831+
autoFocus={false}
6832+
className="form-control"
6833+
disabled={false}
6834+
id="root"
6835+
multiple={false}
6836+
name="root"
6837+
onBlur={[Function]}
6838+
onChange={[Function]}
6839+
onFocus={[Function]}
6840+
role="combobox"
6841+
value=""
6842+
>
6843+
<option
6844+
value=""
6845+
/>
6846+
<option
6847+
value="0"
6848+
>
6849+
Yes
6850+
</option>
6851+
<option
6852+
value="1"
6853+
>
6854+
No
6855+
</option>
6856+
</select>
6857+
</div>
6858+
<div>
6859+
<button
6860+
className="btn btn-info "
6861+
disabled={false}
6862+
type="submit"
6863+
>
6864+
Submit
6865+
</button>
6866+
</div>
6867+
</form>
6868+
`;
6869+
66706870
exports[`single fields slider field 1`] = `
66716871
<form
66726872
className="rjsf"

0 commit comments

Comments
 (0)