feat(project): compact links and add file icons
This commit is contained in:
@@ -628,6 +628,62 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
env.w.localStorage.setItem("pj_side_w", "250"); await boot(env);
|
||||
check("[왼쪽 메뉴] 저장값이 기본 너비와 같아도 명시적으로 복원", env.d.querySelector(".pj-layout").style.getPropertyValue("--pj-side-w") === "250px");
|
||||
}
|
||||
// 파일 형식은 확장자 우선, 확장자 없는 파일은 MIME 으로 구분한다.
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
const samples = [
|
||||
["사진.JPG", "application/octet-stream", "image"],
|
||||
["매출.XLSX", "application/octet-stream", "excel"],
|
||||
["매출.csv", "text/csv", "excel"],
|
||||
["메모.txt", "text/plain", "text"],
|
||||
["발표.pptx", "application/octet-stream", "ppt"],
|
||||
["보고서.docx", "application/octet-stream", "document"],
|
||||
["한글.hwpx", "application/octet-stream", "document"],
|
||||
["자료.pdf", "application/pdf", "pdf"],
|
||||
["이미지", "image/png", "image"],
|
||||
["시트", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "excel"],
|
||||
["발표", "application/vnd.ms-powerpoint", "ppt"],
|
||||
["문서", "application/msword", "document"],
|
||||
["텍스트", "text/plain; charset=utf-8", "text"],
|
||||
["<b>파일</b>.zip", "application/zip", "file"],
|
||||
];
|
||||
env.route("GET", /\/project\/api\/tasks\/101\/attachments/, function () {
|
||||
return { body: { attachments: samples.map(function (s, i) {
|
||||
return { id: 80 + i, filename: s[0], content_type: s[1], size_bytes: 123, comment_id: i === 0 ? 7 : null };
|
||||
}) } };
|
||||
});
|
||||
env.route("GET", /\/project\/api\/projects$/, function () { return { body: { projects: [{ id: 2, name: "P2" }] } }; });
|
||||
env.route("GET", /\/project\/api\/projects\/2\/stages$/, function () { return { body: { stages: [{ id: 21, name: "할 일" }] } }; });
|
||||
env.route("POST", /\/project\/api\/tasks\/101\/links$/, function () { return { body: {} }; });
|
||||
const P = await boot(env), d = env.d;
|
||||
await P.openTaskModal(taskOf(P, 101)); await settle();
|
||||
const items = Array.from(d.querySelectorAll("#pj-attach-list .pj-attach-item"));
|
||||
check("[첨부 아이콘] 모든 파일에 형식별 아이콘·이름·다운로드 링크", items.length === samples.length && items.every(function (li, i) {
|
||||
const icon = li.querySelector(".pj-attach-icon");
|
||||
return icon && icon.classList.contains("is-" + samples[i][2]) && icon.getAttribute("aria-label") &&
|
||||
li.querySelector(".pj-attach-name").textContent === samples[i][0] &&
|
||||
li.querySelector("a").getAttribute("href") === "/project/api/attachments/" + (80 + i) + "/download";
|
||||
}));
|
||||
check("[첨부 아이콘] 파일명 HTML 이스케이프·댓글 배지·삭제 유지", !items[13].querySelector("b") && !!items[0].querySelector(".pj-attach-from-comment") && !!items[0].querySelector(".pj-attach-del"));
|
||||
const row = d.getElementById("pj-links-block");
|
||||
check("[프로젝트 줄] 협업자 바로 아래·설명 위로 이동", d.getElementById("pj-followers-row").nextElementSibling === row && !!row.closest(".pj-meta-list") && !row.hidden);
|
||||
d.getElementById("pj-link-project").value = "2";
|
||||
d.getElementById("pj-link-project").dispatchEvent(new env.w.Event("change")); await settle();
|
||||
d.getElementById("pj-link-save").click(); await settle();
|
||||
check("[프로젝트 줄] 선택한 프로젝트·섹션으로 기존 연결 API 호출", env.calls.some(function (c) {
|
||||
return c.method === "POST" && c.url === "/project/api/tasks/101/links" && c.body.project_id === 2 && c.body.stage_id === 21;
|
||||
}));
|
||||
}
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
env.route("GET", /\/project\/api\/tasks\/101$/, function () { return { body: { task: detail(101, "읽기 전용", {
|
||||
access: "read", links: [{ project_id: 2, project_name: "P2", stage_name: "할 일" }],
|
||||
}) } }; });
|
||||
const P = await boot(env);
|
||||
await P.openTaskModal(taskOf(P, 101)); await settle();
|
||||
const d = env.d;
|
||||
check("[프로젝트 줄] 읽기 전용은 연결 목록만 표시", d.getElementById("pj-link-form").hidden && d.getElementById("pj-links-block").classList.contains("is-readonly") && !!d.querySelector(".pj-link-chip") && !d.querySelector(".pj-link-del"));
|
||||
}
|
||||
clearTimeout(WATCHDOG);
|
||||
console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS");
|
||||
process.exit(fails.length ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user