Skip to content

Commit

Permalink
chore: update formTests
Browse files Browse the repository at this point in the history
  • Loading branch information
KingMario committed Jun 25, 2024
1 parent 51a8945 commit ef86679
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions packages/snapshot-tests/src/formTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ export function formTests(Form: ComponentType<FormProps>, customOptions: FormRen
const tree = renderer.create(<Form schema={schema} uiSchema={uiSchema} validator={validator} />).toJSON();
expect(tree).toMatchSnapshot();
});
test('select field single choice enumDisabled using radio widget', () => {
const schema: RJSFSchema = {
type: 'string',
enum: ['foo', 'bar'],
};
const uiSchema = {
'ui:widget': 'radio',
'ui:enumDisabled': ['bar'],
};
const tree = renderer.create(<Form schema={schema} uiSchema={uiSchema} validator={validator} />).toJSON();
expect(tree).toMatchSnapshot();
});
test('select field multiple choice enumDisabled', () => {
const schema: RJSFSchema = {
type: 'array',
Expand All @@ -226,6 +238,24 @@ export function formTests(Form: ComponentType<FormProps>, customOptions: FormRen
.toJSON();
expect(tree).toMatchSnapshot();
});
test('select field multiple choice enumDisabled using checkboxes', () => {
const schema: RJSFSchema = {
type: 'array',
items: {
type: 'string',
enum: ['foo', 'bar', 'fuzz', 'qux'],
},
uniqueItems: true,
};
const uiSchema = {
'ui:widget': 'checkboxes',
'ui:enumDisabled': ['bar'],
};
const tree = renderer
.create(<Form schema={schema} uiSchema={uiSchema} validator={validator} />, customOptions.selectMulti)
.toJSON();
expect(tree).toMatchSnapshot();
});
test('select field single choice formData', () => {
const schema: RJSFSchema = {
type: 'string',
Expand Down

0 comments on commit ef86679

Please sign in to comment.