之前抽屉一打开就是 Vditor 编辑器,正文是一堆 `##` 和 `-` 的原文, 导入的 84 条旧备忘看着尤其像草稿。现在分成「看」和「写」两态: - 默认只读:按 Markdown 渲染(markdown-it + DOMPurify),分类与标签是 chip, 附件列表只读;底部是「编辑」和状态动作,右侧显示发布于何时。 - 点「编辑」才挂编辑器;「取消」直接丢弃未保存改动(重新拉一次详情)。 - 安卓详情页同样用 Markwon 把正文排版后再显示,要改走「编辑正文」。 顺带修了 `web/e2e/knowledge.mjs` 里一条早就失效的断言:它等的是 「已发布 · 版本 N」,但界面上没有这行字(git 历史里也没有), 改成等抽屉底部的「发布于 …」。 验证:pytest 94 passed、ruff 全绿、tsc 0、vite build ✓; `knowledge-notebook.mjs` 16 项、`knowledge.mjs` 7 项 e2e 全绿。 安卓本轮仍未编译(本机 JDK 25 与 Gradle 8.7/AGP 8.7.3 不兼容)。
This commit is contained in:
@@ -170,6 +170,16 @@ try {
|
||||
),
|
||||
page.getByRole("button", { name: "打开", exact: true }).first().click(),
|
||||
]);
|
||||
// 详情默认是「看」:Markdown 渲染后的样子,不是编辑器
|
||||
await page.locator(".prose-dadao h2").first().waitFor({ timeout: 10_000 });
|
||||
check(
|
||||
"详情抽屉默认渲染样式(不是进来就编辑)",
|
||||
(await page.locator(".vditor-ir").count()) === 0 &&
|
||||
(await page.locator(".prose-dadao h2").first().textContent())?.includes("步骤") === true,
|
||||
);
|
||||
|
||||
// 要改才点「编辑」
|
||||
await page.getByRole("button", { name: "编辑", exact: true }).last().click();
|
||||
const tagInput = page.getByLabel("标签", { exact: true }).last();
|
||||
await tagInput.waitFor({ timeout: 10_000 });
|
||||
// 先等抽屉把自己拉回来的旧标签填上——那一刻之后才没有"迟到的响应"来覆盖输入
|
||||
|
||||
Reference in New Issue
Block a user