* Various fixes * Remove tooltip * another string change * Fix width of custom event name modal to prevent overflow * Booking questions fixes * minor string fix * checkbox alignment * padding in reassign dialog * fix: update FormBuilder tests for checkbox UI changes - Updated test utilities to work with CheckboxField instead of BooleanToggleGroupField - Fixed badge expectations to check for 'optional' instead of 'required' - Updated dialog interaction methods to use checkbox.checked instead of button text - All 13 FormBuilder tests now pass successfully Fixes failing tests in PR #22727 caused by UI changes from toggle buttons to checkboxes for required field selection. Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
66 files changed
+232
-221
No files matched your search
@@ -64,11 +64,9 @@ export default function CreateEventTypeForm({
|
||||
required
|
||||
addOnLeading={
|
||||
!isPlatform ? (
|
||||
<Tooltip content={!isManagedEventType ? pageSlug : t("username_placeholder")}>
|
||||
<span className="max-w-24 md:max-w-56">
|
||||
{`/${!isManagedEventType ? pageSlug : t("username_placeholder")}/`}
|
||||
</span>
|
||||
</Tooltip>
|
||||
<span className="max-w-24 md:max-w-56">
|
||||
{`/${!isManagedEventType ? pageSlug : t("username_placeholder")}/`}
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
containerClassName="[&>div]:gap-0"
|
||||
@@ -115,6 +113,7 @@ export default function CreateEventTypeForm({
|
||||
<TextAreaField {...register("description")} placeholder={t("quick_video_meeting")} />
|
||||
) : (
|
||||
<Editor
|
||||
label={t("description")}
|
||||
getText={() => md.render(form.getValues("description") || "")}
|
||||
setText={(value: string) => form.setValue("description", turndown(value))}
|
||||
excludedToolbarItems={["blockType", "link"]}
|
||||
@@ -145,7 +144,7 @@ export default function CreateEventTypeForm({
|
||||
message: t("duration_max_error", { max: MAX_EVENT_DURATION_MINUTES }),
|
||||
},
|
||||
})}
|
||||
addOnSuffix={t("minutes")}
|
||||
addOnSuffix={t("minutes").toLowerCase()}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -116,19 +116,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
)}>
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Event type title}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("event_name_info")}
|
||||
@@ -136,19 +136,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Event duration}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("event_duration_info")}
|
||||
@@ -156,19 +156,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Organiser}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("your_full_name")}
|
||||
@@ -176,19 +176,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Organiser first name}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("organizer_first_name")}
|
||||
@@ -196,19 +196,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Scheduler}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("scheduler_full_name")}
|
||||
@@ -216,19 +216,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
</div>
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Scheduler first name}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("scheduler_first_name")}
|
||||
@@ -237,19 +237,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
{isNameFieldSplit && (
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Scheduler last name}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("scheduler_last_name")}
|
||||
@@ -258,19 +258,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
)}
|
||||
<div
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.variableItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.variableItem?.variableName
|
||||
)}>
|
||||
{`{Location}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis",
|
||||
"text-emphasis min-w-0 flex-1",
|
||||
customClassNames?.availableVariables?.variableItem?.variableDescription
|
||||
)}>
|
||||
{t("location_info")}
|
||||
@@ -291,19 +291,19 @@ const CustomEventTypeModalForm: FC<CustomEventTypeModalFormProps> = (props) => {
|
||||
<div
|
||||
key={index}
|
||||
className={classNames(
|
||||
"mb-2.5 flex font-normal",
|
||||
"mb-2.5 flex items-start font-normal",
|
||||
customClassNames?.availableVariables?.bookingFieldItem?.container
|
||||
)}>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-subtle ml-1 mr-5 w-32",
|
||||
"text-subtle ml-1 mr-5 w-40 flex-shrink-0",
|
||||
customClassNames?.availableVariables?.bookingFieldItem?.fieldName
|
||||
)}>
|
||||
{`{${bookingfield}}`}
|
||||
</p>
|
||||
<p
|
||||
className={classNames(
|
||||
"text-emphasis capitalize",
|
||||
"text-emphasis min-w-0 flex-1 capitalize",
|
||||
customClassNames?.availableVariables?.bookingFieldItem?.fieldValue
|
||||
)}>
|
||||
{event.bookingFields?.[bookingfield]?.toString()}
|
||||
|
||||
+32
-30
@@ -234,36 +234,38 @@ export default function RequiresConfirmationController({
|
||||
id="notice"
|
||||
value="notice"
|
||||
/>
|
||||
<CheckboxField
|
||||
checked={requiresConfirmationWillBlockSlot}
|
||||
descriptionAsLabel
|
||||
description={t("requires_confirmation_will_block_slot_description")}
|
||||
className={customClassNames?.conditionalConfirmationRadio?.checkbox}
|
||||
descriptionClassName={
|
||||
customClassNames?.conditionalConfirmationRadio?.checkboxDescription
|
||||
}
|
||||
onChange={(e) => {
|
||||
// We set should dirty to properly detect when we can submit the form
|
||||
formMethods.setValue("requiresConfirmationWillBlockSlot", e.target.checked, {
|
||||
shouldDirty: true,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<CheckboxField
|
||||
checked={requiresConfirmationForFreeEmail}
|
||||
descriptionAsLabel
|
||||
description={t("require_confirmation_for_free_email")}
|
||||
className={customClassNames?.conditionalConfirmationRadio?.checkbox}
|
||||
descriptionClassName={
|
||||
customClassNames?.conditionalConfirmationRadio?.checkboxDescription
|
||||
}
|
||||
onChange={(e) => {
|
||||
// We set should dirty to properly detect when we can submit the form
|
||||
formMethods.setValue("requiresConfirmationForFreeEmail", e.target.checked, {
|
||||
shouldDirty: true,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<div className="-ml-1 space-y-2">
|
||||
<CheckboxField
|
||||
checked={requiresConfirmationWillBlockSlot}
|
||||
descriptionAsLabel
|
||||
description={t("requires_confirmation_will_block_slot_description")}
|
||||
className={customClassNames?.conditionalConfirmationRadio?.checkbox}
|
||||
descriptionClassName={
|
||||
customClassNames?.conditionalConfirmationRadio?.checkboxDescription
|
||||
}
|
||||
onChange={(e) => {
|
||||
// We set should dirty to properly detect when we can submit the form
|
||||
formMethods.setValue("requiresConfirmationWillBlockSlot", e.target.checked, {
|
||||
shouldDirty: true,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<CheckboxField
|
||||
checked={requiresConfirmationForFreeEmail}
|
||||
descriptionAsLabel
|
||||
description={t("require_confirmation_for_free_email")}
|
||||
className={customClassNames?.conditionalConfirmationRadio?.checkbox}
|
||||
descriptionClassName={
|
||||
customClassNames?.conditionalConfirmationRadio?.checkboxDescription
|
||||
}
|
||||
onChange={(e) => {
|
||||
// We set should dirty to properly detect when we can submit the form
|
||||
formMethods.setValue("requiresConfirmationForFreeEmail", e.target.checked, {
|
||||
shouldDirty: true,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
Input,
|
||||
InputField,
|
||||
Label,
|
||||
BooleanToggleGroupField,
|
||||
} from "@calcom/ui/components/form";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
@@ -673,26 +672,33 @@ function FieldEditDialog({
|
||||
/>
|
||||
)}
|
||||
|
||||
<Controller
|
||||
name="required"
|
||||
control={fieldForm.control}
|
||||
render={({ field: { value, onChange } }) => {
|
||||
const isRequired = shouldConsiderRequired
|
||||
? shouldConsiderRequired(fieldForm.getValues())
|
||||
: value;
|
||||
return (
|
||||
<BooleanToggleGroupField
|
||||
data-testid="field-required"
|
||||
disabled={fieldForm.getValues("editable") === "system"}
|
||||
value={isRequired}
|
||||
onValueChange={(val) => {
|
||||
onChange(val);
|
||||
}}
|
||||
label={t("required")}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<div className="mt-6">
|
||||
<Controller
|
||||
name="required"
|
||||
control={fieldForm.control}
|
||||
render={({ field: { value, onChange } }) => {
|
||||
let isRequired = shouldConsiderRequired
|
||||
? shouldConsiderRequired(fieldForm.getValues())
|
||||
: value;
|
||||
//by default question should be required
|
||||
if (isRequired === undefined) {
|
||||
isRequired = true;
|
||||
onChange(isRequired);
|
||||
}
|
||||
return (
|
||||
<CheckboxField
|
||||
data-testid="field-required"
|
||||
disabled={fieldForm.getValues("editable") === "system"}
|
||||
checked={isRequired}
|
||||
onChange={(e) => {
|
||||
onChange(e.target.checked);
|
||||
}}
|
||||
description={t("make_field_required")}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -880,10 +886,12 @@ function VariantFields({
|
||||
label={t("identifier")}
|
||||
/>
|
||||
|
||||
<CheckboxField
|
||||
description={t("disable_input_if_prefilled")}
|
||||
{...fieldForm.register("disableOnPrefill", { setValueAs: Boolean })}
|
||||
/>
|
||||
<div className="mt-2">
|
||||
<CheckboxField
|
||||
description={t("disable_input_if_prefilled")}
|
||||
{...fieldForm.register("disableOnPrefill", { setValueAs: Boolean })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ul
|
||||
className={classNames(
|
||||
@@ -921,23 +929,25 @@ function VariantFields({
|
||||
placeholder={t(appUiFieldConfig?.defaultPlaceholder || "")}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name={`${rhfVariantFieldPrefix}.required`}
|
||||
control={fieldForm.control}
|
||||
render={({ field: { onChange } }) => {
|
||||
return (
|
||||
<BooleanToggleGroupField
|
||||
data-testid="field-required"
|
||||
disabled={!appUiFieldConfig?.canChangeRequirability}
|
||||
value={f.required}
|
||||
onValueChange={(val) => {
|
||||
onChange(val);
|
||||
}}
|
||||
label={t("required")}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<div className="mt-6">
|
||||
<Controller
|
||||
name={`${rhfVariantFieldPrefix}.required`}
|
||||
control={fieldForm.control}
|
||||
render={({ field: { onChange } }) => {
|
||||
return (
|
||||
<CheckboxField
|
||||
data-testid="field-required"
|
||||
disabled={!appUiFieldConfig?.canChangeRequirability}
|
||||
checked={f.required}
|
||||
onChange={(e) => {
|
||||
onChange(e.target.checked);
|
||||
}}
|
||||
description={t("make_field_required")}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -97,15 +97,20 @@ export const pageObject = {
|
||||
},
|
||||
dialog: {
|
||||
isFieldShowingAsRequired: ({ dialog }: { dialog: TestingLibraryElement }) => {
|
||||
return (
|
||||
within(dialog.getByTestId("field-required")).getByText("Yes").getAttribute("aria-checked") === "true"
|
||||
);
|
||||
const checkbox = dialog.getByTestId("field-required") as HTMLInputElement;
|
||||
return checkbox.checked;
|
||||
},
|
||||
makeFieldOptional: ({ dialog }: { dialog: TestingLibraryElement }) => {
|
||||
fireEvent.click(within(dialog.getByTestId("field-required")).getByText("No"));
|
||||
const checkbox = dialog.getByTestId("field-required") as HTMLInputElement;
|
||||
if (checkbox.checked) {
|
||||
fireEvent.click(checkbox);
|
||||
}
|
||||
},
|
||||
makeFieldRequired: ({ dialog }: { dialog: TestingLibraryElement }) => {
|
||||
fireEvent.click(within(dialog.getByTestId("field-required")).getByText("Yes"));
|
||||
const checkbox = dialog.getByTestId("field-required") as HTMLInputElement;
|
||||
if (!checkbox.checked) {
|
||||
fireEvent.click(checkbox);
|
||||
}
|
||||
},
|
||||
queryIdentifierInput: ({ dialog }: { dialog: TestingLibraryElement }) => {
|
||||
return dialog.getByLabelText("identifier");
|
||||
@@ -249,10 +254,8 @@ export const expectScenario = {
|
||||
expect(identifierInput.disabled).toBe(true);
|
||||
},
|
||||
toHaveRequirablityToggleDisabled: ({ dialog }: { dialog: TestingLibraryElement }) => {
|
||||
const no = within(dialog.getByTestId("field-required")).getByText("No") as HTMLButtonElement;
|
||||
const yes = within(dialog.getByTestId("field-required")).getByText("Yes") as HTMLButtonElement;
|
||||
expect(no.disabled).toBe(true);
|
||||
expect(yes.disabled).toBe(true);
|
||||
const checkbox = dialog.getByTestId("field-required") as HTMLInputElement;
|
||||
expect(checkbox.disabled).toBe(true);
|
||||
},
|
||||
toHaveLabelChangeAllowed: ({ dialog }: { dialog: TestingLibraryElement }) => {
|
||||
const labelInput = dialog.getByLabelText("label");
|
||||
@@ -268,6 +271,10 @@ export const expectScenario = {
|
||||
const field = getFieldInTheList({ identifier });
|
||||
expect(field.getByText(sourceLabel)).not.toBeNull();
|
||||
},
|
||||
toNotHaveOptionalBadge: ({ identifier }: { identifier: string }) => {
|
||||
const field = getFieldInTheList({ identifier });
|
||||
expect(field.queryByTestId("optional")).toBeNull();
|
||||
},
|
||||
toHaveRequiredBadge: ({ identifier }: { identifier: string }) => {
|
||||
const field = getFieldInTheList({ identifier });
|
||||
expect(field.getByText("required")).not.toBeNull();
|
||||
|
||||
Reference in new issue
Block a user