mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: Viewers can edit means that viewers have acces to Explore #14281
This commit is contained in:
@@ -2,6 +2,7 @@ jest.mock('app/core/core', () => ({}));
|
||||
jest.mock('app/core/config', () => {
|
||||
return {
|
||||
exploreEnabled: true,
|
||||
viewersCanEdit: false,
|
||||
panels: {
|
||||
test: {
|
||||
id: 'test',
|
||||
@@ -14,6 +15,7 @@ jest.mock('app/core/config', () => {
|
||||
import q from 'q';
|
||||
import { PanelModel } from 'app/features/dashboard/panel_model';
|
||||
import { MetricsPanelCtrl } from '../metrics_panel_ctrl';
|
||||
import config from 'app/core/config';
|
||||
|
||||
describe('MetricsPanelCtrl', () => {
|
||||
let ctrl;
|
||||
@@ -46,6 +48,19 @@ describe('MetricsPanelCtrl', () => {
|
||||
expect(additionalItems.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('and has datasource set that supports explore and viewersCanEdit is true', () => {
|
||||
beforeEach(() => {
|
||||
config.viewersCanEdit = true;
|
||||
ctrl.contextSrv = { isEditor: false };
|
||||
ctrl.datasource = { meta: { explore: true } };
|
||||
additionalItems = ctrl.getAdditionalMenuItems();
|
||||
});
|
||||
|
||||
it('should not return any items', () => {
|
||||
expect(additionalItems.length).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user