vicky469_aside/tests/sidebarCommentCardNavigation.test.ts
vicky469 4ff6594ba3 fix(sidebar): keep comment clicks local
Open vault-local HTML links inside Obsidian tabs and keep pinned sidebar card clicks from switching the editor file.
2026-06-07 04:11:53 +08:00

47 lines
1.4 KiB
TypeScript

import * as assert from "node:assert/strict";
import test from "node:test";
import { getSidebarCommentCardOpenAction } from "../src/ui/views/sidebarCommentCardNavigation";
test("pinned markdown-file sidebars select comment cards without switching editor files", () => {
assert.equal(
getSidebarCommentCardOpenAction({
isIndexView: false,
isNonDesktopClient: false,
isPinnedMarkdownFileSidebar: true,
}),
"select-only",
);
});
test("index sidebars keep revealing the comment in the generated index note", () => {
assert.equal(
getSidebarCommentCardOpenAction({
isIndexView: true,
isNonDesktopClient: false,
isPinnedMarkdownFileSidebar: true,
}),
"reveal-index",
);
});
test("unpinned desktop markdown sidebars keep opening the comment in the editor", () => {
assert.equal(
getSidebarCommentCardOpenAction({
isIndexView: false,
isNonDesktopClient: false,
isPinnedMarkdownFileSidebar: false,
}),
"open-editor",
);
});
test("mobile sidebars keep selecting comment cards without editor reveal", () => {
assert.equal(
getSidebarCommentCardOpenAction({
isIndexView: false,
isNonDesktopClient: true,
isPinnedMarkdownFileSidebar: false,
}),
"select-only",
);
});