|
|
@@ -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);
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|