- 1-A 도면 GET · 저장 PUT 한도 60 s · 저장 중 미리받기 쉼 · 끊긴 저장 = 목록 confirmed 로 판정
- 2 CAD 자동백업 열쇠 = b07:{프로젝트}:{도면} · 도각 편집 = b07-frame:{프로젝트} · [초기화] 같은 열쇠
- 3-1 [초기화] 물음 글 = 프로젝트 도각 그대로 · [도각 편집] → [기본 도각 복원] 안내
- 3-2 풀린 장 저장본 json · 수량표 찌꺼기 걷음(_write_manifest 한 곳)
- 5-1 확정 풀기 · 배치 · 축척 = mark_stage(save)
- 7-3 start_stage 가 DEV_UNLOCK 표식 남김
- 6-a navigateDrawing · onNavigate · hasPrev · hasNext 걷음 · 6-b cad-host-save 토글 걷음 · 4-2 B08 안 쓰는 글 11 걷음
- 6-f 특성 판 색 끌기 = 되돌리기 한 칸(paintNowCommitLater 한 벌) · 6-g LAYMRG 사본 길
- 4-1 B09 [인쇄 미리보기] = 저장 뒤 이동 · 단계 그대로 · 6-e M02 카드 도움말 DWG 한 줄
- 시험 test_506_3_* 둘 · cad/undo-506-3 · test_298_2_b07_buttons 열쇠 맞춤
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.5 KiB
TypeScript
78 lines
2.5 KiB
TypeScript
/**
|
|
* 506-3 다 — CAD 되돌리기 두 흠.
|
|
* 6-f 특성 판 색 끌기 = 끄는 동안 화면만 · 멎은 뒤 되돌리기 한 칸(리본 색 칸과 같은 `paintNowCommitLater`).
|
|
* 6-g LAYMRG = 사본으로 갈아 끼움 → Ctrl+Z 한 번에 옛 층.
|
|
* 실행: cd B07_DesignDetail/openwebcad && npx vitest run --config vitest.tmp.config.ts undo-506-3
|
|
*/
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
vi.mock("react-toastify", () => ({
|
|
toast: Object.assign(vi.fn(), { error: vi.fn(), info: vi.fn(), warn: vi.fn(), success: vi.fn() }),
|
|
}));
|
|
|
|
import {
|
|
paintNowCommitLater,
|
|
styleTargets,
|
|
} from "../../../B07_DesignDetail/openwebcad/src/helpers/selection-style";
|
|
import {
|
|
getSelectedEntities,
|
|
resetUndoBaseline,
|
|
setActiveLayerId,
|
|
setLayers,
|
|
setSelectedEntityIds,
|
|
undo,
|
|
} from "../../../B07_DesignDetail/openwebcad/src/state";
|
|
import { click, entities, initIdle, key, type } from "./helpers/cad-drive";
|
|
|
|
const layer = (id: string) => ({ id, name: id, isVisible: true, isLocked: false });
|
|
const line = (a: string, b: string) => {
|
|
type("l");
|
|
type(a);
|
|
type(b);
|
|
key("Escape");
|
|
};
|
|
|
|
beforeEach(() => {
|
|
initIdle();
|
|
setLayers([layer("A"), layer("B")]);
|
|
setActiveLayerId("A");
|
|
});
|
|
afterEach(() => vi.useRealTimers());
|
|
|
|
describe("6-f 특성 판 색 끌기", () => {
|
|
it("끄는 동안 다섯 번 = 되돌리기 한 칸 · Ctrl+Z 한 번에 옛 색", () => {
|
|
line("0,0", "20,0");
|
|
const before = entities()[0].lineColor;
|
|
resetUndoBaseline();
|
|
setSelectedEntityIds([entities()[0].id]);
|
|
vi.useFakeTimers();
|
|
for (const color of ["#110000", "#220000", "#330000", "#440000", "#550000"]) {
|
|
paintNowCommitLater(styleTargets(getSelectedEntities()), (entity) => {
|
|
entity.lineColor = color;
|
|
});
|
|
vi.advanceTimersByTime(50); // 끄는 중(멎기 전)
|
|
}
|
|
expect(entities()[0].lineColor).toBe("#550000");
|
|
vi.advanceTimersByTime(400); // 멎음 → 한 칸
|
|
undo();
|
|
expect(entities()[0].lineColor).toBe(before);
|
|
});
|
|
});
|
|
|
|
describe("6-g LAYMRG", () => {
|
|
it("병합 뒤 Ctrl+Z 한 번 = 옛 층", () => {
|
|
line("0,0", "20,0");
|
|
setActiveLayerId("B");
|
|
line("0,50", "20,50");
|
|
resetUndoBaseline();
|
|
const [onA, onB] = entities();
|
|
expect([onA.layerId, onB.layerId]).toEqual(["A", "B"]);
|
|
type("laymrg");
|
|
click(10, 0);
|
|
click(10, 50);
|
|
expect(entities().map((entity) => entity.layerId)).toEqual(["B", "B"]);
|
|
undo();
|
|
expect(entities().map((entity) => entity.layerId)).toEqual(["A", "B"]);
|
|
});
|
|
});
|