Fix: support renaming pages/files with different casing
This commit is contained in:
@@ -68,4 +68,29 @@ test.describe("Top-bar page rename", () => {
|
||||
await sbPage.keyboard.press(`${mod}+k`);
|
||||
await expect(sbPage.locator(".sb-modal-box")).toBeVisible();
|
||||
});
|
||||
|
||||
test("rename to a different casing of the same name", async ({
|
||||
sbPage,
|
||||
sbServer,
|
||||
}) => {
|
||||
await gotoSilverBulletPage(sbPage, sbServer, "OldName");
|
||||
|
||||
const nameInput = sbPage.locator("#sb-current-page input.sb-input");
|
||||
await nameInput.click();
|
||||
await sbPage.keyboard.press(`${mod}+a`);
|
||||
await sbPage.keyboard.type("oldname");
|
||||
await sbPage.keyboard.press("Enter");
|
||||
|
||||
await sbPage.waitForURL(/\/oldname$/);
|
||||
|
||||
const resp = await fetch(`${sbServer.url}/.fs/oldname.md`);
|
||||
expect(resp.ok).toBe(true);
|
||||
expect(await resp.text()).toContain("Content to keep");
|
||||
|
||||
// Exactly one file, under the new casing.
|
||||
const listResp = await fetch(`${sbServer.url}/.fs`);
|
||||
const names = (await listResp.json()).map((f: { name: string }) => f.name);
|
||||
expect(names).toContain("oldname.md");
|
||||
expect(names).not.toContain("OldName.md");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user