mirror of
https://github.com/firstsun-dev/git-files-sync.git
synced 2026-07-22 06:54:27 +00:00
The view mixed hand-picked Unicode glyphs (✓ ⚠ ↑ ↓ ⟳ ↻ ✕ ≡ ⎇ 📁), duplicated across files, which rendered at inconsistent sizes/weights across platforms and could drift (e.g. the Refresh button used ↻ while the "checking" status used ⟳). Centralize every icon in src/ui/components/icons.ts as Lucide icon ids and render them with Obsidian's setIcon, so status, action-bar, tab, and info-strip icons all share one consistent icon set. Tabs now derive their icon from statusMeta so they can no longer diverge from the file list. Add CSS to size the SVGs uniformly. Add setIcon to the obsidian test mock and update statusMeta expectations. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DwioG4CNKUBuKiZdowLFWe
74 lines
1.5 KiB
TypeScript
74 lines
1.5 KiB
TypeScript
import { vi } from 'vitest';
|
|
|
|
// Mock global browser environment if not in JSDOM
|
|
if (typeof document === 'undefined') {
|
|
(globalThis as unknown as { document: unknown }).document = {
|
|
addEventListener: vi.fn(),
|
|
removeEventListener: vi.fn(),
|
|
};
|
|
}
|
|
if (typeof window === 'undefined') {
|
|
(globalThis as unknown as { window: unknown }).window = {
|
|
setInterval: vi.fn(),
|
|
clearInterval: vi.fn(),
|
|
};
|
|
}
|
|
|
|
// Mock Obsidian API components
|
|
export const Plugin = class {};
|
|
export const PluginSettingTab = class {
|
|
constructor() {}
|
|
};
|
|
export const Setting = class {
|
|
constructor() {}
|
|
setName() { return this; }
|
|
setDesc() { return this; }
|
|
addText() { return this; }
|
|
addToggle() { return this; }
|
|
addButton() { return this; }
|
|
};
|
|
export const Notice = class {
|
|
constructor() {}
|
|
};
|
|
export const Modal = class {
|
|
constructor() {}
|
|
open() {}
|
|
close() {}
|
|
};
|
|
export const MarkdownView = class {};
|
|
export const Editor = class {};
|
|
export const App = class {
|
|
workspace = {
|
|
getActiveViewOfType: vi.fn(),
|
|
on: vi.fn(),
|
|
};
|
|
vault = {
|
|
read: vi.fn(),
|
|
modify: vi.fn(),
|
|
getFileByPath: vi.fn(),
|
|
on: vi.fn(),
|
|
adapter: {
|
|
getBasePath: vi.fn().mockReturnValue('/mock/path'),
|
|
},
|
|
};
|
|
};
|
|
|
|
export const TFile = class {};
|
|
export const requestUrl = vi.fn();
|
|
export const setTooltip = vi.fn();
|
|
export const setIcon = vi.fn();
|
|
|
|
vi.mock('obsidian', () => ({
|
|
Plugin,
|
|
PluginSettingTab,
|
|
Setting,
|
|
Notice,
|
|
Modal,
|
|
MarkdownView,
|
|
Editor,
|
|
App,
|
|
TFile,
|
|
requestUrl,
|
|
setTooltip,
|
|
setIcon,
|
|
}));
|