Files
RuneStone/tests/smoke/tree/renameMarks.smoke.mjs
T
Knotty Wyvern 0fdc991b2e Give way in narrow windows and use one icon for each action
Phase 5-6.

- Side panes give way when the window becomes narrow: the outline
  below 1100 pixels, the side pane below 800 pixels. They come back
  when the window grows. A pane that the user opens in a narrow window
  stays open, and the saved layout keeps the wide-window choice.
- One function has one icon. The SDK icon set gets duplicate, template,
  and tab. The reveal action has one label for each platform (Show in
  Explorer, Show in Finder, Show in file manager).
- The file menu follows one order: open, clipboard, organize, show and
  copy path, history, then Delete and Delete permanently in the error
  color after a separator. The tree copies paths through a Copy path
  submenu, as the tab menu does.
- The tree uses the shared chevron. Search hits come in groups by file,
  with counts and marked matches. Bookmarks show the name, the folder,
  and a remove button.
- All boolean settings use one switch design (src/lib/ui/switch.css).
  Browser settings apply at once, and the Save button is gone. The
  Settings window opens with the focus on its search.
- Targets of at least 24 pixels: the tab close button, outline rows,
  switches, and the settings search.
- Catalog rows in French, Japanese, and Simplified Chinese.
- Docs: UI-052, ui-design.md, and the user guide.

Tests: the new layout/panesAndSettings. Tests that closed or opened
panes by hand around narrow windows now rely on the new behavior, or
wait for the panes to give way before they reopen one. Tests that read
the old menu labels or the browser Save button use the new ones.
2026-10-28 21:31:36 -07:00

44 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Tree rename keeps pins and bookmarks: the file menu offers Copy path › System path, and Undo rename, Ctrl+Z, and Ctrl+Y restore the marks.
import assert from "node:assert/strict";
import { mockTauri, runSmoke, smokeUrl } from "../_harness/index.mjs";
await runSmoke("tree/renameMarks", async ({ page }) => {
await mockTauri(page, {
commands: test => {
const workspace = test.workspace({
root: "C:\\rename-marks",
files: { "a.md": "# Note\n\nOriginal text.", ".runestone/marks.json": JSON.stringify({ pins: ["a.md"], bookmarks: ["a.md"], order: { "": ["a.md"] } }) },
});
test.files = workspace.files;
return {
...workspace,
workspace_list: args => workspace.workspace_list(args).filter(entry => args.rel || entry.rel_path !== ".runestone"),
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 });
await page.goto(smokeUrl);
await row("a.md").click({ button: "right" });
// The file menu copies paths through the Copy path submenu, as the tab menu does.
await item("Copy path").hover();
assert.equal(await item("System path").count(), 1);
await item("Rename").click();
await page.locator(".tree input").fill("renamed.md");
await page.locator(".tree input").press("Enter");
await row("renamed.md").waitFor();
await row("renamed.md").click({ button: "right" });
assert.equal(await item("Undo rename").count(), 1);
await page.keyboard.press("Escape");
await row("renamed.md").focus();
await page.keyboard.press("Control+z");
await row("a.md").waitFor();
assert.deepEqual(await page.evaluate(() => JSON.parse(window.__TEST__.files.get(".runestone/marks.json")).pins), ["a.md"]);
await row("a.md").focus();
await page.keyboard.press("Control+y");
await row("renamed.md").waitFor();
console.log("PASS: Copy path › System path, rename, Undo rename, and Ctrl+Z and Ctrl+Y with marks");
}, { viewport: { width: 1200, height: 850 } });