RuneStone 1.0.0
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// An outside click closes the New file dialog and Find file; a click inside Find file keeps it open.
|
||||
import assert from "node:assert/strict";
|
||||
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
await runSmoke("workspace/dialogDismissal", async ({ page }) => {
|
||||
await mockTauri(page, {
|
||||
commands: test => ({
|
||||
...test.workspace({ root: "C:\\dialog-dismissal", files: { "a.md": "# Note\n\nOriginal text." } }),
|
||||
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
||||
spelling_menu_install: () => null,
|
||||
}),
|
||||
});
|
||||
await page.goto(smokeUrl);
|
||||
await page.locator('[data-tree-rel="a.md"]').waitFor();
|
||||
await page.getByRole("button", { name: "New file Ctrl+N" }).click();
|
||||
await page.getByRole("textbox", { name: "New file path relative to the workspace" }).waitFor();
|
||||
await page.mouse.click(5, 700);
|
||||
assert.equal(await page.locator("dialog").count(), 0, "Outside click dismisses new-file dialog");
|
||||
// The empty tab's button is now "Find file" (src/lib/layout/EditorPane.svelte:167).
|
||||
await page.getByRole("button", { name: "Find file Ctrl+P" }).click();
|
||||
await page.getByRole("textbox", { name: "Find a file" }).click();
|
||||
assert.equal(await page.locator("dialog").count(), 1, "Inside click keeps file search open");
|
||||
await page.mouse.click(5, 700);
|
||||
assert.equal(await page.locator("dialog").count(), 0, "Outside click dismisses file search");
|
||||
console.log("PASS: outside clicks dismiss the New file dialog and Find file");
|
||||
}, { viewport: { width: 1200, height: 850 } });
|
||||
@@ -0,0 +1,91 @@
|
||||
// Note templates from the file pane menu: New note from a template, and the template manager's rename, name conflict, edit, new, delete, and long list.
|
||||
import assert from "node:assert/strict";
|
||||
import path from "node:path";
|
||||
import { mockTauri, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
const name = "workspace/manageTemplates";
|
||||
await runSmoke(name, async ({ page }) => {
|
||||
const output = await outputDir(name);
|
||||
await mockTauri(page, {
|
||||
commands: test => {
|
||||
const workspace = test.workspace({ root: "C:\\manage-templates", files: { "a.md": "# Note\n\nOriginal text.", ".runestone/templates/Daily.md": "# Daily\n\n## Tasks" } });
|
||||
test.files = workspace.files;
|
||||
return {
|
||||
...workspace,
|
||||
workspace_list: args => workspace.workspace_list(args).filter(entry => args.rel || entry.rel_path !== ".runestone"),
|
||||
"plugin:dialog|message": () => "Ok",
|
||||
plugins_snapshot: () => ({ root: "C:/plugins", plugins: [] }),
|
||||
spelling_menu_install: () => null,
|
||||
};
|
||||
},
|
||||
});
|
||||
const row = path => page.locator(`[data-tree-rel="${path}"]`);
|
||||
const item = name => page.getByRole("menuitem", { name, exact: true });
|
||||
const button = name => page.getByRole("button", { name, exact: true });
|
||||
const templateName = () => page.getByRole("textbox", { name: "Template name", exact: true });
|
||||
const file = path => page.evaluate(path => window.__TEST__.files.get(path), path);
|
||||
async function openManager() {
|
||||
await page.getByRole("navigation", { name: "Workspace files" }).click({ button: "right", position: { x: 90, y: 360 } });
|
||||
await item("New note").hover();
|
||||
await item("Manage templates…").click();
|
||||
}
|
||||
await page.goto(smokeUrl);
|
||||
await row("a.md").waitFor();
|
||||
await page.getByRole("navigation", { name: "Workspace files" }).click({ button: "right", position: { x: 90, y: 360 } });
|
||||
await item("New note").hover();
|
||||
// A template reload behind the open menu keeps the menu and its open submenu (src/lib/layout/ContextMenu.svelte).
|
||||
const submenu = page.getByRole("menu", { name: "New note", exact: true });
|
||||
await submenu.waitFor();
|
||||
await submenu.evaluate(node => { node.dataset.smokeMark = "open"; });
|
||||
await page.evaluate(() => window.dispatchEvent(new Event("runestone-templates-changed")));
|
||||
await page.waitForTimeout(300);
|
||||
assert.equal(await page.locator('[data-smoke-mark="open"]:popover-open').count(), 1, "A template reload keeps the open submenu");
|
||||
await item("Daily").click();
|
||||
await row("Daily.md").waitFor();
|
||||
assert.equal(await file("Daily.md"), "# Daily\n\n## Tasks");
|
||||
console.log("PASS: New note from a template");
|
||||
|
||||
await openManager();
|
||||
await button("Rename Daily").click();
|
||||
await templateName().fill("Weekly");
|
||||
await button("Continue").click();
|
||||
await button("Edit Weekly").waitFor();
|
||||
await page.evaluate(() => window.__TEST__.files.set(".runestone/templates/Existing.md", "# Keep this template"));
|
||||
await button("Rename Weekly").click();
|
||||
await templateName().fill("Existing");
|
||||
await button("Continue").click();
|
||||
await page.getByRole("alert").filter({ hasText: "Destination exists" }).waitFor();
|
||||
assert.equal(await file(".runestone/templates/Existing.md"), "# Keep this template");
|
||||
for (const mode of ["light", "dark"]) {
|
||||
await page.evaluate(async mode => { const { saveAppearance } = await import("/src/lib/theme/appearance.ts"); saveAppearance({ theme: "default", mode }); }, mode);
|
||||
await page.screenshot({ path: path.join(output, `templates-${mode}.png`) });
|
||||
}
|
||||
await button("Edit Weekly").click();
|
||||
await page.getByRole("tab", { name: "Weekly.md", exact: true }).waitFor();
|
||||
console.log("PASS: rename, rename conflict, and edit a template");
|
||||
|
||||
await openManager();
|
||||
await button("New template").click();
|
||||
await templateName().fill("Meeting");
|
||||
await button("Continue").click();
|
||||
await page.getByRole("tab", { name: "Meeting.md", exact: true }).waitFor();
|
||||
assert.equal(await file(".runestone/templates/Meeting.md"), "");
|
||||
await openManager();
|
||||
await button("Delete Weekly").click();
|
||||
await button("Edit Weekly").waitFor({ state: "detached" });
|
||||
assert.equal(await file("Daily.md"), "# Daily\n\n## Tasks", "Deleting template preserves notes");
|
||||
await button("Close templates").click();
|
||||
console.log("PASS: create and delete a template");
|
||||
|
||||
await page.evaluate(() => { for (let i = 0; i < 40; i++) window.__TEST__.files.set(`.runestone/templates/Long template name ${i}.md`, "# Template"); });
|
||||
await page.setViewportSize({ width: 600, height: 600 });
|
||||
// The side pane gives way below 800 pixels. The test opens it again.
|
||||
await page.locator("aside.left").waitFor({ state: "detached" });
|
||||
await page.keyboard.press("Control+Backslash");
|
||||
await page.locator("aside.left").waitFor();
|
||||
await openManager();
|
||||
assert.ok(await page.locator("dialog .list").evaluate(node => node.scrollHeight > node.clientHeight), "Long template list scrolls");
|
||||
await page.screenshot({ path: path.join(output, "templates-narrow-long.png") });
|
||||
await button("Close templates").click();
|
||||
console.log("PASS: a long template list scrolls in a narrow window");
|
||||
}, { viewport: { width: 1200, height: 850 } });
|
||||
@@ -0,0 +1,141 @@
|
||||
// Workspace menu: recent history, opening and creating workspaces in new windows, cancellation, errors, keyboard use, removal, and the empty state.
|
||||
import assert from "node:assert/strict";
|
||||
import path from "node:path";
|
||||
import { mockTauri, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
await runSmoke("workspace/openAndCreate", async ({ page }) => {
|
||||
const output = await outputDir("workspace/openAndCreate");
|
||||
// Unknown commands return null, as the original mock did.
|
||||
await mockTauri(page, {
|
||||
strict: false,
|
||||
commands: test => {
|
||||
let current = "D:\\Notes";
|
||||
let recent = ["D:\\Writing\\Notes", current, "D:\\Missing"];
|
||||
let picked = null;
|
||||
let contents = "Original note";
|
||||
const windows = [];
|
||||
Object.assign(test, { windows, pick: path => picked = path, clear: () => recent = [], reorder: () => recent = ["D:\\Writing\\Notes", current, "D:\\Missing"] });
|
||||
return {
|
||||
workspace_last_path: () => current,
|
||||
workspace_recent: () => recent,
|
||||
workspace_forget: args => { recent = recent.filter(path => path !== args.path); return recent; },
|
||||
workspace_list: args => args.rel ? [] : [{ name: "note.txt", rel_path: "note.txt", kind: "file" }],
|
||||
workspace_read: args => { if (args.rel === "note.txt") return contents; throw "File not found"; },
|
||||
workspace_write: args => { contents = args.contents; },
|
||||
"plugin:dialog|open": () => picked,
|
||||
"plugin:dialog|message": () => "Cancel",
|
||||
workspace_new: args => {
|
||||
if (args.name === "Existing") throw "A file or folder with that name already exists.";
|
||||
const root = args.parent + "\\" + args.name;
|
||||
recent = [root, ...recent]; windows.push(root);
|
||||
},
|
||||
workspace_open_window: args => {
|
||||
if (args.path.endsWith("Missing")) throw "folder does not exist";
|
||||
windows.push(args.path);
|
||||
recent = [args.path, ...recent.filter(p => p !== args.path)];
|
||||
},
|
||||
workspace_open: args => {
|
||||
if (args.path.endsWith("Missing")) throw "folder does not exist";
|
||||
current = args.path; recent = [current, ...recent.filter(p => p !== current)];
|
||||
return { root: current, name: current.split("\\").pop(), watch_mode: "native" };
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
await page.goto(smokeUrl);
|
||||
await page.locator(".ws").filter({ hasText: "Notes" }).waitFor();
|
||||
await page.keyboard.press("Control+p");
|
||||
await page.getByRole("textbox", { name: "Find a file" }).fill("note.txt");
|
||||
await page.getByRole("dialog").getByRole("button").filter({ hasText: "note.txt" }).first().click();
|
||||
await page.locator(".source-editor .cm-content").waitFor();
|
||||
await page.evaluate(async () => {
|
||||
window.__EditorView = (await import("/node_modules/@codemirror/view/dist/index.js")).EditorView;
|
||||
const view = window.__EditorView.findFromDOM(document.querySelector(".source-editor .cm-content"));
|
||||
view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: "My pending edit" } });
|
||||
});
|
||||
// The workspace switcher sits in the bar at the bottom of the side pane (src/lib/layout/LeftPane.svelte).
|
||||
// When the side pane gives way in a narrow window, the switcher is at the bottom of the left ribbon.
|
||||
const trigger = page.locator(".workspace-button, .ribbon-workspace button").first();
|
||||
const menu = page.getByRole("dialog", { name: "Workspaces", exact: true });
|
||||
await page.evaluate(() => window.__TEST__.reorder());
|
||||
await trigger.click();
|
||||
await menu.getByText("D:\\Writing\\Notes", { exact: true }).waitFor();
|
||||
await page.mouse.move(1000, 50);
|
||||
assert.equal(await menu.locator('.workspace-row').first().evaluate(node => node === document.activeElement), false, "Pointer opening does not force focus onto a different workspace");
|
||||
assert.equal(await menu.locator('.workspace-row').first().evaluate(node => getComputedStyle(node).backgroundColor), "rgba(0, 0, 0, 0)", "The first workspace has no stuck highlight");
|
||||
assert.equal(await menu.locator('[aria-current="true"]').count(), 1);
|
||||
assert.equal(await page.evaluate(() => window.__TEST__.calls.filter(c => c.command === "plugin:dialog|open").length), 0);
|
||||
await page.screenshot({ path: path.join(output, "workspaces-menu.png") });
|
||||
// A second click on the switcher closes the menu. It does not open the menu again.
|
||||
await trigger.click();
|
||||
await menu.waitFor({ state: "hidden", timeout: 2000 });
|
||||
await trigger.click();
|
||||
await menu.getByText("D:\\Writing\\Notes", { exact: true }).waitFor();
|
||||
const opened =await page.evaluate(() => window.__TEST__.calls.filter(c => c.command === "workspace_open").length);
|
||||
await menu.getByRole("button").filter({ hasText: "Current" }).click();
|
||||
assert.equal(await page.evaluate(() => window.__TEST__.calls.filter(c => c.command === "workspace_open").length), opened);
|
||||
await page.keyboard.press("Control+o");
|
||||
await menu.getByRole("button").filter({ hasText: "Missing" }).click();
|
||||
await menu.getByRole("alert").filter({ hasText: "folder does not exist" }).waitFor();
|
||||
await menu.getByRole("button", { name: "Open another folder…" }).click();
|
||||
assert(await menu.isVisible(), "Cancelling folder picker keeps history available");
|
||||
await menu.getByRole("button").filter({ hasText: "D:\\Writing\\Notes" }).click();
|
||||
await menu.waitFor({ state: "hidden" });
|
||||
assert.equal(await page.locator(".ws").textContent(), "Notes");
|
||||
assert.deepEqual(await page.evaluate(() => window.__TEST__.windows), ["D:\\Writing\\Notes"]);
|
||||
await trigger.click();
|
||||
await page.evaluate(() => window.__TEST__.pick("D:\\Other"));
|
||||
await menu.getByRole("button", { name: "Open another folder…" }).click();
|
||||
await menu.waitFor({ state: "hidden" });
|
||||
assert.equal(await page.locator(".ws").textContent(), "Notes");
|
||||
await trigger.click();
|
||||
await menu.getByRole("button", { name: "New workspace…" }).click();
|
||||
const dialog = page.getByRole("dialog", { name: "New workspace", exact: true });
|
||||
assert(await dialog.getByRole("button", { name: "Create workspace", exact: true }).isDisabled());
|
||||
await dialog.getByLabel("Workspace name").fill("Existing");
|
||||
await page.evaluate(() => window.__TEST__.pick("D:\\Projects"));
|
||||
await dialog.getByRole("button", { name: "Browse…" }).click();
|
||||
await dialog.getByRole("button", { name: "Create workspace", exact: true }).click();
|
||||
await dialog.getByRole("alert").filter({ hasText: "already exists" }).waitFor();
|
||||
await dialog.getByLabel("Workspace name").fill("Fresh notes");
|
||||
await page.screenshot({ path: path.join(output, "workspaces-create.png") });
|
||||
await dialog.getByRole("button", { name: "Create workspace", exact: true }).click();
|
||||
await dialog.waitFor({ state: "hidden" });
|
||||
assert.equal(await page.locator(".ws").textContent(), "Notes");
|
||||
assert.deepEqual(await page.evaluate(() => window.__TEST__.windows), ["D:\\Writing\\Notes", "D:\\Other", "D:\\Projects\\Fresh notes"]);
|
||||
assert.equal(await page.evaluate(() => window.__TEST__.calls.filter(c => c.command === "workspace_open").length), opened);
|
||||
assert.equal(await page.evaluate(() => window.__TEST__.calls.filter(c => c.command === "plugin:dialog|message").length), 0);
|
||||
assert.equal(await page.evaluate(() => window.__EditorView.findFromDOM(document.querySelector(".source-editor .cm-content"))?.state.doc.toString()), "My pending edit");
|
||||
assert(await page.getByRole("tab", { name: /note\.txt/ }).isVisible());
|
||||
await trigger.click();
|
||||
await page.keyboard.press("End");
|
||||
assert.equal(await page.locator(":focus").textContent(), " Open another folder…");
|
||||
await page.keyboard.press("Escape");
|
||||
await menu.waitFor({ state: "hidden" });
|
||||
for (const theme of ['light', 'dark']) {
|
||||
await page.evaluate(async mode => {
|
||||
const { applyAppearance } = await import('/src/lib/theme/appearance.ts');
|
||||
applyAppearance({ theme: 'default', mode });
|
||||
}, theme);
|
||||
await page.setViewportSize({ width: theme === 'light' ? 1100 : 380, height: 800 });
|
||||
await trigger.click();
|
||||
await menu.getByRole('button', { name: 'Remove D:\\Missing from recent workspaces', exact: true }).focus();
|
||||
await page.screenshot({ path: path.join(output, `workspaces-remove-${theme}.png`) });
|
||||
if (theme === 'dark') {
|
||||
await page.keyboard.press('Enter');
|
||||
await menu.getByText('D:\\Missing', { exact: true }).waitFor({ state: 'detached' });
|
||||
await page.keyboard.press('Escape');
|
||||
await trigger.click();
|
||||
assert.equal(await menu.getByText('D:\\Missing', { exact: true }).count(), 0, 'Removed paths stay absent after reopening');
|
||||
}
|
||||
await page.keyboard.press('Escape');
|
||||
}
|
||||
await page.setViewportSize({ width: 1100, height: 800 });
|
||||
assert.equal(await page.locator('.ws').textContent(), 'Notes', 'History removal does not close the current workspace');
|
||||
await page.evaluate(() => window.__TEST__.clear());
|
||||
await trigger.click();
|
||||
await menu.getByText("No recent workspaces yet.").waitFor();
|
||||
await page.getByRole("button", { name: "New tab (Ctrl+T)", exact: true }).click();
|
||||
await menu.waitFor({ state: "hidden" });
|
||||
console.log("Workspace smoke passed: history, opening and creating in new windows, original workspace preserved, cancellation, errors, keyboard and empty state.");
|
||||
}, { viewport: { width: 1100, height: 800 }, timeout: 30000 });
|
||||
@@ -0,0 +1,35 @@
|
||||
// Save a note as a template from the file tree, then create a note from it with the empty tab's New note button.
|
||||
import assert from "node:assert/strict";
|
||||
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
await runSmoke("workspace/saveAsTemplate", async ({ page }) => {
|
||||
await mockTauri(page, {
|
||||
commands: test => {
|
||||
const workspace = test.workspace({ root: "C:\\save-template", files: { "a.md": "# Alpha\n\nTemplate body.\n", "b.md": "# Beta\n", ".runestone/config.json": "{}" } });
|
||||
test.files = workspace.files;
|
||||
return {
|
||||
...workspace,
|
||||
workspace_list: args => workspace.workspace_list(args).filter(entry => args.rel || args.showInternal || entry.rel_path !== ".runestone"),
|
||||
plugins_snapshot: () => ({ plugins: [], issues: [] }),
|
||||
spelling_menu_install: () => null,
|
||||
};
|
||||
},
|
||||
});
|
||||
const row = path => page.locator(`[data-tree-rel="${path}"]`);
|
||||
const menu = label => page.getByRole("menuitem", { name: label, exact: true });
|
||||
await page.goto(smokeUrl);
|
||||
await row("a.md").click();
|
||||
await page.locator(".cm-content").waitFor();
|
||||
await row("a.md").click({ button: "right" });
|
||||
await menu("Save as template").click();
|
||||
await page.getByRole("textbox", { name: "Template name" }).fill("Meeting");
|
||||
await page.getByRole("button", { name: "Continue", exact: true }).click();
|
||||
await page.waitForFunction(() => window.__TEST__.files.has(".runestone/templates/Meeting.md"));
|
||||
await page.getByRole("button", { name: "New tab (Ctrl+T)", exact: true }).click();
|
||||
// The file tree toolbar also has a "New note" button (src/lib/layout/FileTree.svelte:886); this one is in the empty tab (src/lib/layout/EditorPane.svelte:166).
|
||||
await page.getByRole("main").getByRole("button", { name: "New note", exact: true }).click();
|
||||
await menu("Meeting").click();
|
||||
await page.getByRole("tab", { name: /Meeting/ }).waitFor();
|
||||
assert.equal(await page.evaluate(() => window.__TEST__.files.get("Meeting.md")), "# Alpha\n\nTemplate body.\n");
|
||||
console.log("PASS: Save as template, and New note from the saved template");
|
||||
}, { timeout: 15000 });
|
||||
@@ -0,0 +1,77 @@
|
||||
// Workspace session: a title rename moves pins and bookmarks, marks from another window reach the panes, watcher paths update the tree and backlinks, and focus does not rescan the workspace.
|
||||
import assert from "node:assert/strict";
|
||||
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
||||
|
||||
await runSmoke("workspace/session", async ({ page }) => {
|
||||
await mockTauri(page, {
|
||||
commands: test => {
|
||||
const ws = test.workspace({
|
||||
root: "C:\\smoke-workspace",
|
||||
files: {
|
||||
"notes/welcome.md": "# Welcome\n",
|
||||
"notes/other.md": "# Other\n",
|
||||
".runestone/marks.json": JSON.stringify({ pins: ["notes/welcome.md"], bookmarks: ["notes/welcome.md"], order: {} }, null, 2) + "\n",
|
||||
},
|
||||
});
|
||||
const files = ws.files;
|
||||
Object.assign(test, { files, root: ws.root });
|
||||
return {
|
||||
...ws,
|
||||
workspace_rename: ({ from, to }) => {
|
||||
if (!files.has(from)) throw new Error("File is missing");
|
||||
files.set(to, files.get(from));
|
||||
files.delete(from);
|
||||
},
|
||||
spelling_menu_install: () => null,
|
||||
};
|
||||
},
|
||||
});
|
||||
const marks = () => page.evaluate(() => JSON.parse(window.__TEST__.files.get(".runestone/marks.json")));
|
||||
const emit = (kind, paths) => page.evaluate(([kind, paths]) => window.__TEST__.emit("workspace-event", { root: window.__TEST__.root, kind, paths }), [kind, paths]);
|
||||
const tree = page.locator(".tree");
|
||||
const backlinks = page.getByRole("region", { name: "Backlinks" });
|
||||
|
||||
await page.goto(smokeUrl);
|
||||
await page.getByText("smoke-workspace", { exact: true }).waitFor();
|
||||
await tree.getByText("notes", { exact: true }).click();
|
||||
await tree.getByText("welcome", { exact: true }).dblclick();
|
||||
const title = page.getByRole("button", { name: "Rename note", exact: true });
|
||||
await title.click();
|
||||
await page.getByRole("textbox", { name: "Note filename", exact: true }).fill("renamed");
|
||||
await page.keyboard.press("Enter");
|
||||
await page.waitForFunction(() => document.querySelector(".breadcrumb")?.title === "notes/renamed.md");
|
||||
await page.waitForFunction(() => window.__TEST__.files.get(".runestone/marks.json").includes("notes/renamed.md"));
|
||||
assert.deepEqual(await marks(), { pins: ["notes/renamed.md"], bookmarks: ["notes/renamed.md"], order: {} }, "A title rename moves the pin and the bookmark");
|
||||
await tree.getByText("renamed", { exact: true }).waitFor();
|
||||
|
||||
await page.getByRole("button", { name: "Bookmarks", exact: true }).click();
|
||||
const bookmarks = page.locator(".pane").filter({ hasText: "Bookmarks" });
|
||||
// A bookmark shows the file name and its folder, with the full path in its tooltip.
|
||||
await bookmarks.locator('button[title="notes/renamed.md"]').waitFor();
|
||||
// Another window bookmarks a second note. The watcher reports the marks file.
|
||||
await page.evaluate(() => window.__TEST__.files.set(".runestone/marks.json", JSON.stringify({ pins: ["notes/renamed.md"], bookmarks: ["notes/renamed.md", "notes/other.md"], order: {} })));
|
||||
await emit("modify", [".runestone/marks.json"]);
|
||||
await bookmarks.locator('button[title="notes/other.md"]').waitFor();
|
||||
await page.getByRole("button", { name: "Files", exact: true }).click();
|
||||
|
||||
// A note that another program creates appears in the tree and in the backlinks, without a rescan.
|
||||
const listCalls = () => page.evaluate(() => window.__TEST__.calls.filter(call => call.command === "workspace_list").length);
|
||||
const before = await listCalls();
|
||||
await page.evaluate(() => window.__TEST__.files.set("notes/linker.md", "See [[renamed]] for details.\n"));
|
||||
await emit("create", ["notes/linker.md"]);
|
||||
await tree.getByText("linker", { exact: true }).waitFor();
|
||||
await backlinks.getByText("notes/linker.md").waitFor();
|
||||
assert.ok(await listCalls() - before <= 3, "One change lists only the folders that it touches");
|
||||
|
||||
const afterChange = await listCalls();
|
||||
await page.evaluate(() => window.dispatchEvent(new Event("focus")));
|
||||
await page.waitForTimeout(400);
|
||||
assert.equal(await listCalls(), afterChange, "Window focus does not rescan the workspace");
|
||||
|
||||
// A deleted note leaves the tree and the backlinks.
|
||||
await page.evaluate(() => window.__TEST__.files.delete("notes/linker.md"));
|
||||
await emit("remove", ["notes/linker.md"]);
|
||||
await backlinks.getByText("No other notes link to this file.").waitFor();
|
||||
assert.equal(await tree.getByText("linker", { exact: true }).count(), 0);
|
||||
console.log("PASS: title rename moves marks, marks from another window, watcher paths update the tree and backlinks, no rescan on focus.");
|
||||
});
|
||||
Reference in New Issue
Block a user