mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 16:30:27 +00:00
Introduces HTMLService to centralize HTML/DOM operations and updates SearchTrigger, StreamingMarkdownService, and tests to use the new service instead of directly manipulating innerHTML and DOM methods.
24 lines
505 B
TypeScript
24 lines
505 B
TypeScript
/**
|
|
* Test setup file - runs before all tests
|
|
*/
|
|
|
|
import { afterEach, vi } from 'vitest';
|
|
|
|
// Mock global window if needed
|
|
if (typeof global.window === 'undefined') {
|
|
global.window = {} as any;
|
|
}
|
|
|
|
// Add Obsidian's .empty() method to HTMLElement prototype for testing
|
|
if (typeof HTMLElement !== 'undefined') {
|
|
HTMLElement.prototype.empty = function() {
|
|
while (this.firstChild) {
|
|
this.removeChild(this.firstChild);
|
|
}
|
|
};
|
|
}
|
|
|
|
// Clean up after each test
|
|
afterEach(() => {
|
|
vi.clearAllMocks();
|
|
});
|