feat(cupang): 센터 즉시 추가·대화상자 센터 버튼 선택
- ③ 센터 분배: 목록에서 센터를 고르는 즉시 추가된다. "+ 센터 추가" 버튼 제거. 고른 뒤 선택값을 비워 같은 센터를 다시 고를 수 있게 한다. - 담기 대화상자: 센터 select 를 추가된 센터 버튼 목록으로 바꿔 한 번에 대상을 고른다(현재 대상은 검은 버튼 + aria-pressed). tests/js: 센터 추가를 change 이벤트로, 대화상자 센터 버튼 표시·전환· 선택한 센터로 담기는지까지 검증. 전체 통과. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,7 @@ function dragCardTo(card, target) {
|
||||
// ── ③ 센터는 추가한 것만 표시 ─────────────────────
|
||||
check("초기 센터 패널 없음", $$(".cpg-dist-center").length === 0);
|
||||
$("#cpg-center-pick").value = "1";
|
||||
$("#cpg-center-add").click();
|
||||
fire($("#cpg-center-pick"), "change");
|
||||
check("센터 추가 후 1개 표시", $$(".cpg-dist-center").length === 1, String($$(".cpg-dist-center").length));
|
||||
check("추가한 센터 이름", text(".cpg-dist-center strong") === "대구3", text(".cpg-dist-center strong"));
|
||||
|
||||
@@ -97,7 +97,10 @@ function dragCardTo(card, target) {
|
||||
check("드롭 후 고스트 제거", !$(".cpg-drag-ghost"));
|
||||
check("드롭하면 대화상자가 열린다", $("#cpg-dlg").hidden === false);
|
||||
check("대화상자에 잔여/개수 표시", text("#cpg-dlg-item").includes("잔여 2박스 (16개)"), text("#cpg-dlg-item"));
|
||||
check("대화상자 센터 = 드롭한 센터", $("#cpg-dlg-center").value === "1");
|
||||
check("대화상자에 센터 버튼 표시", $$(".cpg-dlg-center-btn").length === 1, String($$(".cpg-dlg-center-btn").length));
|
||||
check("드롭한 센터 버튼이 선택됨",
|
||||
$(".cpg-dlg-center-btn[aria-pressed='true']").getAttribute("data-center") === "1",
|
||||
$(".cpg-dlg-center-btn[aria-pressed='true']").getAttribute("data-center"));
|
||||
|
||||
// 1박스만 담기
|
||||
$("#cpg-dlg-qty").value = "1";
|
||||
@@ -153,7 +156,7 @@ function dragCardTo(card, target) {
|
||||
|
||||
// ── 드롭 실패 경로 방어 ───────────────────────────
|
||||
$("#cpg-center-pick").value = "2";
|
||||
$("#cpg-center-add").click();
|
||||
fire($("#cpg-center-pick"), "change");
|
||||
check("센터 다시 추가", $$(".cpg-dist-center").length === 1, String($$(".cpg-dist-center").length));
|
||||
|
||||
// (1) 패널이 아닌 ③ 카드 여백에 놓아도 센터가 하나면 그 센터로
|
||||
@@ -169,6 +172,24 @@ function dragCardTo(card, target) {
|
||||
check("③ 밖에 놓으면 담기지 않는다", $("#cpg-dlg").hidden === true && $$(".cpg-dist-item").length === 0);
|
||||
check("③ 밖 드롭 안내 메시지", text("#cpg-calc-msg").includes("센터 위에 놓아야"), text("#cpg-calc-msg"));
|
||||
|
||||
// (3) 대화상자에서 센터 버튼으로 대상 변경
|
||||
$("#cpg-center-pick").value = "1";
|
||||
fire($("#cpg-center-pick"), "change");
|
||||
check("센터 2개 표시", $$(".cpg-dist-center").length === 2, String($$(".cpg-dist-center").length));
|
||||
$(".cpg-sum-prod.is-draggable").click();
|
||||
check("센터 2개 → 버튼 2개", $$(".cpg-dlg-center-btn").length === 2);
|
||||
const other = $$(".cpg-dlg-center-btn").filter(b => b.getAttribute("aria-pressed") !== "true")[0];
|
||||
const otherId = other.getAttribute("data-center");
|
||||
other.click();
|
||||
check("버튼 클릭으로 센터 변경",
|
||||
$(".cpg-dlg-center-btn[aria-pressed='true']").getAttribute("data-center") === otherId);
|
||||
$("#cpg-dlg-qty").value = "1";
|
||||
$("#cpg-dlg-ok").click();
|
||||
const target = $('[data-drop-for="' + otherId + '"]');
|
||||
check("선택한 센터에 담긴다", target.querySelectorAll(".cpg-dist-item").length === 1);
|
||||
target.querySelector(".cpg-dist-del").click();
|
||||
$(".cpg-dist-close").click();
|
||||
|
||||
// (3) 드래그 없이 클릭한 경우
|
||||
$(".cpg-sum-prod.is-draggable").click();
|
||||
check("클릭 대체 경로 동작", $("#cpg-dlg").hidden === false);
|
||||
|
||||
Reference in New Issue
Block a user