Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(test): align editor chrome source contracts

tianma-ife860d6848e27
diff --git a/apps/web/src/components/FocusModeEntry.test.mjs b/apps/web/src/components/FocusModeEntry.test.mjs
index 647b8297..65b7df66 100644
--- a/apps/web/src/components/FocusModeEntry.test.mjs
+++ b/apps/web/src/components/FocusModeEntry.test.mjs
@@ -3,28 +3,31 @@ import { readFileSync } from "node:fs";
const editorPaneSource = readFileSync(new URL("./EditorPane.tsx", import.meta.url), "utf8");
const diagramEditorPaneSource = readFileSync(new URL("./DiagramEditorPane.tsx", import.meta.url), "utf8");
+const topRowLeadingSource = readFileSync(new URL("./MemoEditorTopRowLeading.tsx", import.meta.url), "utf8");
const expectDiscoverableFocusModeEntry = (source) => {
const normalizedSource = source.replace(/\s+/g, " ");
expect(normalizedSource).toContain('size="sm" variant={desktopFocusMode ? "soft" : "ghost"}');
- expect(normalizedSource).toContain('<span>{t(desktopFocusMode ? "editor.exitFocusMode" : "editor.focusMode")}</span>');
+ expect(normalizedSource).toContain('<span>{focusModeLabel}</span>');
expect(source).not.toContain('size="sm"\n variant="solid"');
};
describe("focus mode entry", () => {
test("labels a restrained action in every desktop note editor instead of relying on an ambiguous icon", () => {
- expectDiscoverableFocusModeEntry(editorPaneSource);
- expectDiscoverableFocusModeEntry(diagramEditorPaneSource);
+ expectDiscoverableFocusModeEntry(topRowLeadingSource);
+ for (const source of [editorPaneSource, diagramEditorPaneSource]) {
+ expect(source).toContain("<MemoEditorTopRowLeading");
+ expect(source).toContain("desktopFocusMode={desktopFocusMode}");
+ expect(source).toContain("onToggleDesktopFocusMode={onToggleDesktopFocusMode}");
+ }
});
- test("groups the standard editor entry with note view controls instead of top-level navigation", () => {
- const readingProtectionIconIndex = editorPaneSource.indexOf(
- '{desktopReadingProtection ? <Lock className="h-4 w-4" /> : <LockOpen className="h-4 w-4" />}',
- );
- const focusModeEntryIndex = editorPaneSource.indexOf(
- 'title={t(desktopFocusMode ? "editor.exitFocusMode" : "editor.enterFocusMode")}',
- );
- expect(readingProtectionIconIndex).toBeGreaterThan(-1);
- expect(focusModeEntryIndex).toBeGreaterThan(readingProtectionIconIndex);
+ test("keeps the focus mode entry in the shared editor header instead of top-level navigation", () => {
+ for (const source of [editorPaneSource, diagramEditorPaneSource]) {
+ const focusModeEntryIndex = source.indexOf("<MemoEditorTopRowLeading");
+ const headerActionsIndex = source.indexOf("<MemoEditorHeaderActions");
+ expect(focusModeEntryIndex).toBeGreaterThan(-1);
+ expect(headerActionsIndex).toBeGreaterThan(focusModeEntryIndex);
+ }
});
});
diff --git a/apps/web/src/components/SystemInfoAccess.test.mjs b/apps/web/src/components/SystemInfoAccess.test.mjs
index 8f022884..0eacb202 100644
--- a/apps/web/src/components/SystemInfoAccess.test.mjs
+++ b/apps/web/src/components/SystemInfoAccess.test.mjs
@@ -1,13 +1,13 @@
import { describe, expect, test } from "bun:test";
import { readFileSync } from "node:fs";
-const editorPaneSource = readFileSync(new URL("./EditorPane.tsx", import.meta.url), "utf8");
+const headerActionsSource = readFileSync(new URL("./MemoEditorHeaderActions.tsx", import.meta.url), "utf8");
const settingsPaneSource = readFileSync(new URL("./SettingsPane.tsx", import.meta.url), "utf8");
describe("system information access", () => {
test("keeps a compact-workspace entry in the editor overflow menu", () => {
- expect(editorPaneSource).toMatch(
- /<DropdownMenuItem[\s\S]*?min-\[1600px\]:hidden[\s\S]*?setSystemInfoOpen\(true\)[\s\S]*?systemInfo\.title[\s\S]*?<\/DropdownMenuItem>/,
+ expect(headerActionsSource).toMatch(
+ /<DropdownMenuItem[\s\S]*?min-\[1600px\]:hidden[\s\S]*?handleSystemInfoOpenChange\(true\)[\s\S]*?systemInfo\.title[\s\S]*?<\/DropdownMenuItem>/,
);
});