chore: some minor QA fixes (#22727)
Post release / release (push) Canceled after 0s

* 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:
authored and GitHub committed 2025-08-25 18:11:18 +09:00
1 parent 9b7c6585d8
commit 5bab2af500
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()}
@@ -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>
+52 -42
View File
@@ -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>
);
})}
+16 -9
View File
@@ -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();
@@ -149,13 +149,13 @@ function getNavigation({ length, multipleDuration, t, tabs, url, onClick, curren
const tabsNavigation: VerticalTabItemProps[] = [];
tabs.includes("setup") &&
tabsNavigation.push({
name: t("event_setup_tab_title"),
name: t("basics"),
onClick: () => onClick("setup"),
isActive: currentTab === "setup",
href: `${url}?tabName=setup`,
icon: "link",
info: `${duration} ${t("minute_timeUnit")}`, // TODO: Get this from props
"data-testid": `event_setup_tab_title`,
"data-testid": `basics`,
});
tabs.includes("limits") &&
tabsNavigation.push({
@@ -195,11 +195,11 @@ function getNavigation({
return [
{
name: t("event_setup_tab_title"),
name: t("basics"),
href: `/event-types/${id}?tabName=setup`,
icon: "link",
info: `${duration} ${t("minute_timeUnit")}`, // TODO: Get this from props
"data-testid": `event_setup_tab_title`,
"data-testid": `basics`,
},
{
name: t("event_limit_tab_title"),
+3 -2
View File
@@ -61,8 +61,9 @@ export const Editor = (props: TextEditorProps) => {
const plainText = props.plainText ?? false;
return (
<div className="editor rounded-md">
{props.label && <label className="mb-1 block text-sm font-medium leading-6">{props.label}</label>}
<LexicalComposer initialConfig={{ ...editorConfig }}>
<div className="editor-container hover:border-emphasis focus-within:ring-brand-default !rounded-lg p-0 transition focus-within:ring-2">
<div className="editor-container hover:border-emphasis focus-within:ring-brand-default !rounded-lg p-0 transition focus-within:ring-2 focus-within:ring-offset-0">
<ToolbarPlugin
getText={props.getText}
setText={props.setText}
@@ -82,7 +83,7 @@ export const Editor = (props: TextEditorProps) => {
<ContentEditable
readOnly={!editable}
style={{ height: props.height }}
className="editor-input"
className="editor-input focus:outline-none"
data-testid="editor-input"
/>
}
+1
View File
@@ -15,4 +15,5 @@ export type TextEditorProps = {
setFirstRender?: Dispatch<SetStateAction<boolean>>;
editable?: boolean;
plainText?: boolean;
label?: string;
};
@@ -75,8 +75,8 @@ export const Switch = (
<Label.Root
htmlFor={id}
className={cx(
"text-emphasis align-text-top font-medium",
size === "sm" ? "m-1 text-xs" : "m-2 text-sm",
"text-emphasis font-medium",
size === "sm" ? "m-1 text-xs" : "ml-2 mt-1 text-sm",
primitiveProps.disabled ? "cursor-not-allowed opacity-25" : "cursor-pointer",
labelOnLeading && "flex-1"
)}>