feat(project): 설명란 링크 굵게·기울임·밑줄, 한 글자처럼 한 번에 지우기
- 링크는 contenteditable=false 로 잠가 커서가 링크 글자 안으로 들어가지 않음 - 링크 바로 뒤 Backspace·바로 앞 Delete = 링크 통째로 삭제(execCommand, Ctrl+Z 가능) - 저장 HTML 에서는 잠금 표시를 뺀다(getHtml) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,8 @@ function boardHtml() {
|
||||
const data = JSON.parse(json);
|
||||
const base = data.tasks.find(function (t) { return t.id === 101; });
|
||||
base.description = "<p>앞 글</p>";
|
||||
const b = data.tasks.find(function (t) { return t.id === 102; });
|
||||
b.description = '<p>앞 <a href="https://example.com/x">링크 글자</a> 뒤</p><p>끝 링크 <a href="https://example.com/y">마지막</a></p>';
|
||||
data.tasks.push(Object.assign({}, base, { description: "", id: 104, title: "작업 C(완료)", completed_at: "2026-10-01T00:00:00+09:00", sort_order: 104 }));
|
||||
data.tasks.push(Object.assign({}, base, { description: "", id: 105, title: "작업 D", sort_order: 105 }));
|
||||
return a + JSON.stringify(data) + c;
|
||||
@@ -140,6 +142,47 @@ async function dropFile(page, selector, name) {
|
||||
await page.waitForTimeout(500);
|
||||
const n = await page.$$eval('#pj-t-desc a[href*="drive.google.com"]', els => els.map(e => e.textContent));
|
||||
check("열린 업무 카드 → 편집기에 링크(append 아님)", drives.length === 3 && !drives[2].append && n.indexOf("사진.jpg") >= 0, { drives: drives, n: n });
|
||||
|
||||
// ── 5) 설명란 링크 = 굵게·기울임·밑줄, 한 글자처럼(Backspace·Delete 한 번에 통째로, Ctrl+Z 로 되살림)
|
||||
await page.keyboard.press("Escape");
|
||||
await page.waitForTimeout(300);
|
||||
await page.evaluate(() => { const c = document.querySelector('.pj-card[data-task-id="102"] .pj-card-title'); c.click(); });
|
||||
await page.waitForFunction(() => document.getElementById("pj-t-desc").textContent.includes("링크 글자"));
|
||||
const st = await page.evaluate(() => {
|
||||
const a = document.querySelector("#pj-t-desc a"), cs = getComputedStyle(a);
|
||||
return { ce: a.getAttribute("contenteditable"), w: cs.fontWeight, i: cs.fontStyle, u: cs.textDecorationLine };
|
||||
});
|
||||
check("링크 서식 굵게·기울임·밑줄 + 잠금", st.ce === "false" && +st.w >= 700 && st.i === "italic" && st.u.includes("underline"), st);
|
||||
function caret(where) { // where: "after1" = 첫 링크 바로 뒤, "before2" = 둘째 링크 바로 앞
|
||||
return page.evaluate((w) => {
|
||||
const box = document.getElementById("pj-t-desc"); box.focus();
|
||||
const as = box.querySelectorAll("a"), r = document.createRange();
|
||||
if (w === "after1") r.setStart(as[0].nextSibling, 0);
|
||||
else { const t = as[as.length - 1].previousSibling; r.setStart(t, t.nodeValue.length); }
|
||||
r.collapse(true); const s = getSelection(); s.removeAllRanges(); s.addRange(r);
|
||||
}, where);
|
||||
}
|
||||
await caret("after1");
|
||||
await page.keyboard.press("Backspace");
|
||||
let txt = await page.evaluate(() => ({ t: document.getElementById("pj-t-desc").textContent, n: document.querySelectorAll("#pj-t-desc a").length }));
|
||||
check("링크 바로 뒤 Backspace 한 번 → 링크 통째로 지움", txt.n === 1 && !txt.t.includes("링크 글자") && txt.t.replace(/ /g, " ").includes("앞 뒤"), txt);
|
||||
await page.keyboard.press("Control+z");
|
||||
txt = await page.evaluate(() => document.querySelectorAll("#pj-t-desc a").length);
|
||||
check("Ctrl+Z 로 링크 되살림", txt === 2, txt);
|
||||
await caret("before2");
|
||||
await page.keyboard.press("Delete");
|
||||
txt = await page.evaluate(() => ({ t: document.getElementById("pj-t-desc").textContent, n: document.querySelectorAll("#pj-t-desc a").length }));
|
||||
check("링크 바로 앞 Delete 한 번 → 링크 통째로 지움", !txt.t.includes("마지막") && txt.t.includes("끝 링크"), txt);
|
||||
await page.keyboard.press("Control+z");
|
||||
// 줄 끝 링크 오른쪽을 눌러 이어 쓰면 링크 밖에 써진다
|
||||
const last = await page.locator("#pj-t-desc a").last().boundingBox();
|
||||
await page.mouse.click(last.x + last.width + 40, last.y + last.height / 2);
|
||||
await page.keyboard.type("추가");
|
||||
txt = await page.evaluate(() => { const a = [...document.querySelectorAll("#pj-t-desc a")].pop(); return { a: a.textContent, p: a.parentElement.textContent }; });
|
||||
check("줄 끝 링크 뒤에 이어 쓰기(링크 밖)", txt.a === "마지막" && /마지막추가$/.test(txt.p), txt);
|
||||
await page.waitForTimeout(1600);
|
||||
const saved = puts.filter(p => p.id === 102 && p.body.description != null).pop();
|
||||
check("저장 HTML 에 잠금 표시(contenteditable) 없음", !!saved && !saved.body.description.includes("contenteditable"), saved);
|
||||
} finally { await browser.close(); server.close(); }
|
||||
console.log(fails.length ? "\n" + fails.length + " FAILED" : "\nALL PASS");
|
||||
process.exit(fails.length ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user