테스트 오류 수정
CI / test (push) Successful in 5m19s
CI / e2e (push) Has been skipped
CI / pr_and_merge (push) Successful in 1m59s

This commit is contained in:
2025-12-09 20:20:47 +09:00
parent 676e58cad7
commit 23a08621db
3 changed files with 43 additions and 62 deletions
@@ -457,72 +457,52 @@ options: [
} as any,
},
];
type: "form",
props: {
kind: "contact",
submitTarget: "internal",
requiredFieldIds: ["radio_required"],
} as any,
},
{
id: "radio_required",
type: "formRadio",
props: {
groupLabel: "플랜",
formFieldName: "plan",
options: [
{ label: "A", value: "a" },
{ label: "B", value: "b" },
],
} as any,
},
];
const { getByTestId } = render(<PublicPageRenderer blocks={blocks} />);
const { getByTestId } = render(<PublicPageRenderer blocks={blocks} />);
const group = getByTestId("preview-form-radio-group") as HTMLElement;
const inputs = group.querySelectorAll("input[type='radio']");
expect(inputs.length).toBe(2);
const group = getByTestId("preview-form-radio-group") as HTMLElement;
const inputs = group.querySelectorAll("input[type='radio']");
expect(inputs.length).toBe(2);
const first = inputs[0] as HTMLInputElement;
const second = inputs[1] as HTMLInputElement;
const first = inputs[0] as HTMLInputElement;
const second = inputs[1] as HTMLInputElement;
expect(first.type).toBe("radio");
expect(first.name).toBe("plan");
expect(first.value).toBe("a");
expect(first.required).toBe(true);
expect(first.type).toBe("radio");
expect(first.name).toBe("plan");
expect(first.value).toBe("a");
expect(first.required).toBe(true);
expect(second.type).toBe("radio");
expect(second.name).toBe("plan");
expect(second.value).toBe("b");
expect(second.required).toBe(false);
});
expect(second.type).toBe("radio");
expect(second.name).toBe("plan");
expect(second.value).toBe("b");
expect(second.required).toBe(false);
});
it("formCheckbox 블록의 각 옵션 라벨은 builder.css 의 pb-form-option 클래스를 사용해야 한다", () => {
const blocks: Block[] = [
{
id: "form_checkbox_pb_option_class",
type: "formCheckbox",
props: {
groupLabel: "옵션들",
formFieldName: "features",
options: [
{ label: "옵션 1", value: "opt1" },
{ label: "옵션 2", value: "opt2" },
],
} as any,
},
];
it("formCheckbox 블록의 각 옵션 라벨은 builder.css 의 pb-form-option 클래스를 사용해야 한다", () => {
const blocks: Block[] = [
{
id: "form_checkbox_pb_option_class",
type: "formCheckbox",
props: {
groupLabel: "옵션들",
formFieldName: "features",
options: [
{ label: "옵션 1", value: "opt1" },
{ label: "옵션 2", value: "opt2" },
],
} as any,
},
];
const { getByTestId } = render(<PublicPageRenderer blocks={blocks} />);
const { getByTestId } = render(<PublicPageRenderer blocks={blocks} />);
const group = getByTestId("preview-form-checkbox-group") as HTMLElement;
const optionLabels = group.querySelectorAll("label");
expect(optionLabels.length).toBeGreaterThan(0);
optionLabels.forEach((label) => {
expect((label as HTMLLabelElement).className).toContain("pb-form-option");
});
});
const group = getByTestId("preview-form-checkbox-group") as HTMLElement;
const optionLabels = group.querySelectorAll("label");
expect(optionLabels.length).toBeGreaterThan(0);
optionLabels.forEach((label) => {
expect((label as HTMLLabelElement).className).toContain("pb-form-option");
});
});
it("formRadio 프리뷰의 옵션 input 은 OS 기본 스타일을 사용하기 위해 색상 관련 Tailwind 클래스(bg-/text-/border-)를 사용하지 않아야 한다", () => {
const blocks: Block[] = [