레이아웃 시스템: 섹션/컬럼 및 컬럼 간 DnD 구현

This commit is contained in:
2025-11-18 08:16:42 +09:00
parent d21252eb1f
commit dc55449efb
4 changed files with 399 additions and 25 deletions
+38
View File
@@ -253,3 +253,41 @@ test("버튼 블록을 추가하고 라벨과 링크를 수정할 수 있어야
const updatedButton = canvas.getByRole("button", { name: "자세히 보기" });
await expect(updatedButton).toBeVisible();
});
test("2컬럼 섹션에서 블록을 다른 컬럼 영역으로 드래그하면 컬럼이 변경되어야 한다", async ({ page }) => {
await page.goto("/editor");
const canvas = page.getByTestId("editor-canvas");
// 섹션을 하나 추가하고 레이아웃을 2컬럼으로 변경한다.
await page.getByRole("button", { name: "섹션 블록 추가" }).click();
// 섹션을 선택한다 (캔버스 첫 블록).
const sectionBlock = canvas.getByTestId("editor-block").nth(0);
await sectionBlock.click();
const layoutSelect = page.getByRole("combobox", { name: "섹션 레이아웃" });
await layoutSelect.selectOption("2col");
// 왼쪽 컬럼에 텍스트 블록을 하나 추가한다.
await page.getByRole("button", { name: "텍스트 블록 추가" }).click();
const leftColumn = canvas.locator('[data-section-id][data-column-id]').nth(0);
const rightColumn = canvas.locator('[data-section-id][data-column-id]').nth(1);
// 왼쪽 컬럼 안에 텍스트 블록이 존재하는지 확인한다.
const leftBlocks = leftColumn.getByTestId("editor-block");
await expect(leftBlocks).toHaveCount(1);
// 왼쪽 컬럼의 첫 블록을 오른쪽 컬럼 droppable 영역으로 드래그한다.
const leftBlock = leftBlocks.nth(0);
const handle = leftBlock.getByRole("button", { name: "블록 드래그 핸들" });
await handle.dragTo(rightColumn);
// 드래그 이후, 오른쪽 컬럼 안에 블록이 존재해야 하고 왼쪽 컬럼은 비어 있어야 한다.
const rightBlocks = rightColumn.getByTestId("editor-block");
await expect(rightBlocks).toHaveCount(1);
// 왼쪽 컬럼에는 더 이상 블록이 없어야 한다.
await expect(leftColumn.getByTestId("editor-block")).toHaveCount(0);
});