mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 08:35:43 -06:00
* Began work on panel menu * SceneDashboard: Basic state handling for inspect panel * Switched to using scene url sync instead * Updated * Update comment on hack * Fixed url synnc issues and more / better DashboardsLoader tests * Progress on test * Updates * Progress * Progress * Update * Update * Update * Update * Update scenes lib * Update * Update --------- Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import { DeepPartial } from '@grafana/scenes';
|
|
import { DashboardLoaderSrv, setDashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv';
|
|
import { DashboardDTO } from 'app/types';
|
|
|
|
export function setupLoadDashboardMock(rsp: DeepPartial<DashboardDTO>) {
|
|
const loadDashboardMock = jest.fn().mockResolvedValue(rsp);
|
|
setDashboardLoaderSrv({
|
|
loadDashboard: loadDashboardMock,
|
|
} as unknown as DashboardLoaderSrv);
|
|
return loadDashboardMock;
|
|
}
|
|
|
|
export function mockResizeObserver() {
|
|
(window as any).ResizeObserver = class ResizeObserver {
|
|
constructor(callback: ResizeObserverCallback) {
|
|
setTimeout(() => {
|
|
callback(
|
|
[
|
|
{
|
|
contentRect: {
|
|
x: 1,
|
|
y: 2,
|
|
width: 500,
|
|
height: 500,
|
|
top: 100,
|
|
bottom: 0,
|
|
left: 100,
|
|
right: 0,
|
|
},
|
|
} as ResizeObserverEntry,
|
|
],
|
|
this
|
|
);
|
|
});
|
|
}
|
|
observe() {}
|
|
disconnect() {}
|
|
unobserve() {}
|
|
};
|
|
}
|