Commit d77448d8 by Torkel Ödegaard

Fixed unit tests for grafanaGraph component

parent 8fc5a278
...@@ -14,10 +14,13 @@ define([ ...@@ -14,10 +14,13 @@ define([
function graphScenario(desc, func) { function graphScenario(desc, func) {
describe(desc, function() { describe(desc, function() {
var ctx = {}; var ctx = {};
ctx.setup = function (setupFunc) { ctx.setup = function (setupFunc) {
beforeEach(module(function($provide) { beforeEach(module(function($provide) {
$provide.value("timeSrv", new helpers.TimeSrvStub()); $provide.value("timeSrv", new helpers.TimeSrvStub());
})); }));
beforeEach(inject(function($rootScope, $compile) { beforeEach(inject(function($rootScope, $compile) {
var scope = $rootScope.$new(); var scope = $rootScope.$new();
var element = angular.element("<div style='width:500px' grafana-graph><div>"); var element = angular.element("<div style='width:500px' grafana-graph><div>");
...@@ -28,10 +31,13 @@ define([ ...@@ -28,10 +31,13 @@ define([
grid: {}, grid: {},
y_formats: [], y_formats: [],
seriesOverrides: [], seriesOverrides: [],
tooltip: { tooltip: {
shared: true shared: true
} }
}; };
scope.appEvent = sinon.spy();
scope.onAppEvent = sinon.spy();
scope.hiddenSeries = {}; scope.hiddenSeries = {};
scope.dashboard = { timezone: 'browser' }; scope.dashboard = { timezone: 'browser' };
scope.range = { scope.range = {
......
...@@ -10,12 +10,14 @@ define([ ...@@ -10,12 +10,14 @@ define([
formatDate: sinon.stub().returns('date'), formatDate: sinon.stub().returns('date'),
}; };
var scope = { var scope = {
appEvent: sinon.spy(),
onAppEvent: sinon.spy(),
panel: { panel: {
tooltip: { tooltip: {
shared: true shared: true
}, },
y_formats: ['ms', 'none'], y_formats: ['ms', 'none'],
stack: true stack: true
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment