mirror of
https://github.com/callumalpass/tasknotes.git
synced 2026-07-22 12:50:26 +00:00
fix: Add missing setTooltip mock to fix failing tests
Add setTooltip function mock to the Obsidian API test mock to match the native tooltip functionality recently introduced in the codebase. This resolves all TaskCard test failures caused by missing mock implementation. - Adds setTooltip mock with same signature as Obsidian's native function - Includes proper tooltip attribute setting for test verification - Exports setTooltip in both named and default exports for compatibility Fixes 39 failing TaskCard tests.
This commit is contained in:
parent
dbe1fe940d
commit
2082b7e4a3
1 changed files with 12 additions and 0 deletions
|
|
@ -857,6 +857,16 @@ export function setIcon(element: HTMLElement, iconName: string): void {
|
|||
element.classList.add('has-icon');
|
||||
}
|
||||
|
||||
// Tooltip utilities
|
||||
export function setTooltip(element: HTMLElement, tooltip: string, options?: { placement?: string }): void {
|
||||
// Mock implementation - just add tooltip attributes
|
||||
element.setAttribute('data-tooltip', tooltip);
|
||||
if (options?.placement) {
|
||||
element.setAttribute('data-tooltip-placement', options.placement);
|
||||
}
|
||||
element.classList.add('has-tooltip');
|
||||
}
|
||||
|
||||
// Keymap mock class
|
||||
export class Keymap {
|
||||
pushScope = jest.fn();
|
||||
|
|
@ -924,6 +934,7 @@ export const MockObsidian = {
|
|||
Menu,
|
||||
Notice,
|
||||
setIcon,
|
||||
setTooltip,
|
||||
};
|
||||
|
||||
// Default export for compatibility
|
||||
|
|
@ -953,6 +964,7 @@ export default {
|
|||
Notice,
|
||||
Events,
|
||||
setIcon,
|
||||
setTooltip,
|
||||
parseLinktext,
|
||||
MockObsidian,
|
||||
};
|
||||
Loading…
Reference in a new issue