fixing unit tests
This commit is contained in:
@@ -21,15 +21,21 @@ export class QueriesTab extends React.Component<Props, any> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { panel, dashboard } = this.props;
|
||||||
|
|
||||||
|
// make sure the panel has datasource & queries properties
|
||||||
|
panel.datasource = panel.datasource || null;
|
||||||
|
panel.targets = panel.targets || [{}];
|
||||||
|
|
||||||
const loader = getAngularLoader();
|
const loader = getAngularLoader();
|
||||||
const template = '<metrics-tab />';
|
const template = '<metrics-tab />';
|
||||||
const scopeProps = {
|
const scopeProps = {
|
||||||
ctrl: {
|
ctrl: {
|
||||||
panel: this.props.panel,
|
panel: panel,
|
||||||
dashboard: this.props.dashboard,
|
dashboard: dashboard,
|
||||||
panelCtrl: {
|
panelCtrl: {
|
||||||
panel: this.props.panel,
|
panel: panel,
|
||||||
dashboard: this.props.dashboard,
|
dashboard: dashboard,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ export class PanelModel {
|
|||||||
|
|
||||||
// defaults
|
// defaults
|
||||||
this.gridPos = this.gridPos || { x: 0, y: 0, h: 3, w: 6 };
|
this.gridPos = this.gridPos || { x: 0, y: 0, h: 3, w: 6 };
|
||||||
this.datasource = this.datasource || null;
|
|
||||||
this.targets = this.targets || [{}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSaveModel() {
|
getSaveModel() {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ describe('when updating view state', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const $scope = {
|
const $scope = {
|
||||||
|
appEvent: jest.fn(),
|
||||||
onAppEvent: jest.fn(() => {}),
|
onAppEvent: jest.fn(() => {}),
|
||||||
dashboard: new DashboardModel({
|
dashboard: new DashboardModel({
|
||||||
panels: [{ id: 1 }],
|
panels: [{ id: 1 }],
|
||||||
|
|||||||
Reference in New Issue
Block a user