mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* wip * serialisation tests updates * VizPanelManager test updates * ests updates * Making it green * Use DashboardGridItem instead of SceneGridItem * Cleanup tests that unnecessarily depend on dashboard grid items * Fix row repeater behavior test * Update public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com> * Fix unnecessary library panel changes detection * Fix test --------- Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import { SceneGridLayout, SceneTimeRange } from '@grafana/scenes';
|
|
|
|
import { DashboardScene } from '../scene/DashboardScene';
|
|
import { activateFullSceneTree } from '../utils/test-utils';
|
|
|
|
import { PermissionsEditView } from './PermissionsEditView';
|
|
|
|
describe('PermissionsEditView', () => {
|
|
describe('Dashboard permissions state', () => {
|
|
let dashboard: DashboardScene;
|
|
let permissionsView: PermissionsEditView;
|
|
|
|
beforeEach(async () => {
|
|
const result = await buildTestScene();
|
|
dashboard = result.dashboard;
|
|
permissionsView = result.permissionsView;
|
|
});
|
|
|
|
it('should return the correct urlKey', () => {
|
|
expect(permissionsView.getUrlKey()).toBe('permissions');
|
|
});
|
|
|
|
it('should return the dashboard', () => {
|
|
expect(permissionsView.getDashboard()).toBe(dashboard);
|
|
});
|
|
});
|
|
});
|
|
|
|
async function buildTestScene() {
|
|
const permissionsView = new PermissionsEditView({});
|
|
const dashboard = new DashboardScene({
|
|
$timeRange: new SceneTimeRange({}),
|
|
title: 'hello',
|
|
uid: 'dash-1',
|
|
version: 4,
|
|
meta: {
|
|
canEdit: true,
|
|
},
|
|
body: new SceneGridLayout({
|
|
children: [],
|
|
}),
|
|
editview: permissionsView,
|
|
});
|
|
|
|
activateFullSceneTree(dashboard);
|
|
|
|
await new Promise((r) => setTimeout(r, 1));
|
|
|
|
dashboard.onEnterEditMode();
|
|
permissionsView.activate();
|
|
|
|
return { dashboard, permissionsView };
|
|
}
|