feat: added node-tooltips to the editor

This commit is contained in:
Gerla, J. (Justin)
2026-01-13 11:29:45 +00:00
committed by Björn Otgaar
parent 5385bd72b1
commit 566c4c18cc
16 changed files with 332 additions and 28 deletions

View File

@@ -19,6 +19,48 @@ export function renderWithProviders(
}
type SidebarRect = Partial<DOMRect>;
const defaultRect: DOMRect = {
top: 0,
left: 0,
bottom: 100,
right: 200,
width: 200,
height: 100,
x: 0,
y: 0,
toJSON: () => {},
};
/**
* Renders a component and injects a mock `#draggable-sidebar`
* element required by Tooltip positioning logic.
*/
export function renderWithSidebar(
ui: ReactElement,
rect: SidebarRect = {},
options?: RenderOptions
) {
const sidebar = document.createElement('div');
sidebar.id = 'draggable-sidebar';
sidebar.getBoundingClientRect = jest.fn(() => ({
...defaultRect,
...rect,
}));
document.body.appendChild(sidebar);
const result = render(ui, options);
return {
...result,
sidebar,
};
}
// Re-export everything from testing library
//eslint-disable-next-line react-refresh/only-export-components
export * from '@testing-library/react';