Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f80b45e36a | ||
|
|
f3d60b141f | ||
|
|
5463dc261c |
Vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@calcom/web",
|
"name": "@calcom/web",
|
||||||
"version": "5.7.2",
|
"version": "5.7.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "ANALYZE=true next build",
|
"analyze": "ANALYZE=true next build",
|
||||||
|
|||||||
@@ -2202,6 +2202,7 @@
|
|||||||
"booking_confirmation_failed": "Booking confirmation failed",
|
"booking_confirmation_failed": "Booking confirmation failed",
|
||||||
"not_enough_seats": "Not enough seats",
|
"not_enough_seats": "Not enough seats",
|
||||||
"form_builder_field_already_exists": "A field with this name already exists",
|
"form_builder_field_already_exists": "A field with this name already exists",
|
||||||
|
"guests_field_must_be_multiemail": "Guests field must be of type 'Multiple emails'",
|
||||||
"show_on_booking_page": "Show on booking page",
|
"show_on_booking_page": "Show on booking page",
|
||||||
"visit_cancelled_booking": "You can visit the canceled booking page",
|
"visit_cancelled_booking": "You can visit the canceled booking page",
|
||||||
"get_started_zapier_templates": "Get started with Zapier templates",
|
"get_started_zapier_templates": "Get started with Zapier templates",
|
||||||
|
|||||||
@@ -6,4 +6,9 @@
|
|||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
/**
|
||||||
|
* Following properties are added to ensure that the embedding page isn't able to affect these properties
|
||||||
|
*/
|
||||||
|
display: block !important; /* A website made all iframes' display flex breaking the embed */
|
||||||
|
color-scheme: unset !important; /* A website had explicitly set color-scheme to something for all iframes */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
import { TooltipProvider } from "@radix-ui/react-tooltip";
|
||||||
import { render } from "@testing-library/react";
|
import { render, screen, waitFor } from "@testing-library/react";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import { vi } from "vitest";
|
import { vi } from "vitest";
|
||||||
|
|
||||||
|
import { showToast } from "@calcom/ui/components/toast";
|
||||||
|
|
||||||
import { FormBuilder } from "./FormBuilder";
|
import { FormBuilder } from "./FormBuilder";
|
||||||
import {
|
import {
|
||||||
mockProps,
|
mockProps,
|
||||||
@@ -32,6 +34,10 @@ vi.mock("next/navigation", async (importOriginal) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vi.mock("@calcom/ui/components/toast", () => ({
|
||||||
|
showToast: vi.fn(),
|
||||||
|
}));
|
||||||
|
|
||||||
const renderComponent = ({
|
const renderComponent = ({
|
||||||
formBuilderProps: formBuilderProps,
|
formBuilderProps: formBuilderProps,
|
||||||
formDefaultValues: formDefaultValues,
|
formDefaultValues: formDefaultValues,
|
||||||
@@ -219,7 +225,6 @@ describe("FormBuilder", () => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
verifier.verifyOptionPrices({ identifier, prices: [20, 25] });
|
verifier.verifyOptionPrices({ identifier, prices: [20, 25] });
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -271,4 +276,40 @@ describe("FormBuilder", () => {
|
|||||||
verifier.verifyOptionPrices({ identifier, prices: [50, 75, 100] });
|
verifier.verifyOptionPrices({ identifier, prices: [50, 75, 100] });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Guests Field Validation Tests", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
renderComponent({ formBuilderProps: mockProps, formDefaultValues: {} });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should prevent saving guests field with non-multiemail type", async () => {
|
||||||
|
const dialog = pageObject.openAddFieldDialog();
|
||||||
|
|
||||||
|
pageObject.dialog.selectFieldType({ dialog, fieldType: "text" });
|
||||||
|
pageObject.dialog.fillInFieldIdentifier({ dialog, identifier: "guests" });
|
||||||
|
pageObject.dialog.fillInFieldLabel({ dialog, label: "Guests", fieldType: "text" });
|
||||||
|
|
||||||
|
pageObject.dialog.saveField({ dialog });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(showToast).toHaveBeenCalledWith("guests_field_must_be_multiemail", "error");
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(screen.queryByTestId("field-guests")).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should allow saving guests field with multiemail type", async () => {
|
||||||
|
const dialog = pageObject.openAddFieldDialog();
|
||||||
|
|
||||||
|
pageObject.dialog.selectFieldType({ dialog, fieldType: "multiemail" });
|
||||||
|
pageObject.dialog.fillInFieldIdentifier({ dialog, identifier: "guests" });
|
||||||
|
pageObject.dialog.fillInFieldLabel({ dialog, label: "Guests", fieldType: "multiemail" });
|
||||||
|
|
||||||
|
pageObject.dialog.saveField({ dialog });
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByTestId("field-guests")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -380,6 +380,12 @@ export const FormBuilder = function FormBuilder({
|
|||||||
handleSubmit={(data: Parameters<SubmitHandler<RhfFormField>>[0]) => {
|
handleSubmit={(data: Parameters<SubmitHandler<RhfFormField>>[0]) => {
|
||||||
const type = data.type || "text";
|
const type = data.type || "text";
|
||||||
const isNewField = !fieldDialog.data;
|
const isNewField = !fieldDialog.data;
|
||||||
|
|
||||||
|
if (data.name === "guests" && type !== "multiemail") {
|
||||||
|
showToast(t("guests_field_must_be_multiemail"), "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isNewField && fields.some((f) => f.name === data.name)) {
|
if (isNewField && fields.some((f) => f.name === data.name)) {
|
||||||
showToast(t("form_builder_field_already_exists"), "error");
|
showToast(t("form_builder_field_already_exists"), "error");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user