Skip to content

Commit

Permalink
✨ [#2] Remove multiple when not multipleCapable
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Oct 30, 2023
1 parent ce5b7b5 commit 7cae54c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/formio/components/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ export interface CheckboxComponentSchema
extends Omit<CheckboxInputSchema, 'hideLabel' | 'disabled'> {
type: 'checkbox';
defaultValue: boolean;
multiple?: false;
}
1 change: 0 additions & 1 deletion src/formio/components/selectboxes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export type SelectboxesInputSchema = InputComponentSchema<
interface BaseSelectboxesSchema {
type: 'selectboxes';
defaultValue: Record<string, boolean>;
multiple?: false;
}

/**
Expand Down
15 changes: 2 additions & 13 deletions test-d/formio/components/checkbox.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ expectAssignable<CheckboxComponentSchema>({
});


// multiple false and appropriate default value type
expectAssignable<CheckboxComponentSchema>({
id: 'yejak',
type: 'checkbox',
key: 'someCheckbox',
label: 'Some checkbox',
multiple: false,
defaultValue: true,
});

// full, correct schema
expectAssignable<CheckboxComponentSchema>({
id: 'yejak',
Expand All @@ -34,7 +24,6 @@ expectAssignable<CheckboxComponentSchema>({
showInSummary: true,
showInEmail: false,
showInPDF: true,
multiple: false,
hidden: false,
clearOnHide: true,
isSensitiveData: true,
Expand Down Expand Up @@ -66,13 +55,13 @@ expectAssignable<CheckboxComponentSchema>({
validateOn: 'blur',
});

// multiple true not allowed
// multiple not allowed
expectNotAssignable<CheckboxComponentSchema>({
id: 'yejak',
type: 'checkbox',
key: 'someCheckbox',
label: 'Some checkbox',
multiple: true,
multiple: 'dummy',
});

// defaultValue not allowed
Expand Down
21 changes: 2 additions & 19 deletions test-d/formio/components/selectboxes.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,12 @@ expectAssignable<SelectboxesComponentSchema>({
},
});

// multiple false and appropriate default value type
expectAssignable<SelectboxesComponentSchema>({
id: 'yejak',
type: 'selectboxes',
key: 'someSelectboxes',
label: 'Some selectboxes',
multiple: false,
defaultValue: {dummy: true},
openForms: {
dataSrc: 'variable',
itemsExpression: 'dummy',
translations: {},
},
});

// values translations
expectAssignable<SelectboxesComponentSchema>({
id: 'yejak',
type: 'selectboxes',
key: 'someSelectboxes',
label: 'Some selectboxes',
multiple: false,
defaultValue: {dummy: true},
openForms: {
dataSrc: 'manual',
Expand Down Expand Up @@ -92,7 +76,6 @@ expectAssignable<SelectboxesComponentSchema>({
showInSummary: true,
showInEmail: false,
showInPDF: true,
multiple: false,
hidden: false,
clearOnHide: true,
isSensitiveData: true,
Expand Down Expand Up @@ -134,13 +117,13 @@ expectNotAssignable<SelectboxesComponentSchema>({
label: 'Some selectboxes',
});

// multiple true not allowed
// multiple not allowed
expectNotAssignable<SelectboxesComponentSchema>({
id: 'yejak',
type: 'selectboxes',
key: 'someSelectboxes',
label: 'Some selectboxes',
multiple: true,
multiple: 'dummy',
openForms: {
dataSrc: 'variable',
itemsExpression: 'dummy',
Expand Down

0 comments on commit 7cae54c

Please sign in to comment.