에디터 정리 및 버그 수정
CI / test (push) Failing after 13m50s
CI / pr_and_merge (push) Has been cancelled

This commit is contained in:
2025-12-01 13:34:16 +09:00
parent 5f541e9524
commit 6ad731b6e2
76 changed files with 1348 additions and 29 deletions
+80
View File
@@ -99,4 +99,84 @@ describe("ButtonPropertiesPanel", () => {
expect.objectContaining({ widthMode: "fixed" }),
);
});
it("버튼 이미지 URL 인풋 변경 시 updateBlock 이 imageSrc 와 imageSourceType(externalUrl) 으로 호출되어야 한다", () => {
const updateBlock = vi.fn();
render(
<ButtonPropertiesPanel
buttonProps={{
...baseProps,
imageSrc: "https://example.com/old.png",
imageSourceType: "externalUrl",
} as any}
selectedBlockId="btn-img-url"
updateBlock={updateBlock}
/>,
);
const urlInput = screen.getByLabelText("버튼 이미지 URL");
fireEvent.change(urlInput, { target: { value: "https://example.com/new.png" } });
expect(updateBlock).toHaveBeenCalledWith(
"btn-img-url",
expect.objectContaining({
imageSrc: "https://example.com/new.png",
imageSourceType: "externalUrl",
}),
);
});
it("버튼 이미지 위치 셀렉트 변경 시 updateBlock 이 imagePlacement 로 호출되어야 한다", () => {
const updateBlock = vi.fn();
render(
<ButtonPropertiesPanel
buttonProps={{
...baseProps,
imagePlacement: "left",
imageSrc: "https://example.com/icon.png",
imageSourceType: "externalUrl",
} as any}
selectedBlockId="btn-img-pos"
updateBlock={updateBlock}
/>,
);
const select = screen.getByLabelText("버튼 이미지 위치");
fireEvent.change(select, { target: { value: "right" } });
expect(updateBlock).toHaveBeenCalledWith(
"btn-img-pos",
expect.objectContaining({ imagePlacement: "right" }),
);
});
it("버튼 이미지 소스 셀렉트에서 URL/업로드를 전환할 수 있어야 한다", () => {
const updateBlock = vi.fn();
render(
<ButtonPropertiesPanel
buttonProps={{
...baseProps,
imageSrc: "/api/image/test-id",
imageSourceType: "asset",
} as any}
selectedBlockId="btn-img-source"
updateBlock={updateBlock}
/>,
);
const select = screen.getByLabelText("버튼 이미지 소스");
// 업로드 → URL 로 전환
fireEvent.change(select, { target: { value: "url" } });
expect(updateBlock).toHaveBeenCalledWith(
"btn-img-source",
expect.objectContaining({
imageSourceType: "externalUrl",
imageAssetId: null,
}),
);
});
});