2014-08-19 03:46:08 -05:00
|
|
|
define([
|
2014-12-23 14:01:50 -06:00
|
|
|
'helpers',
|
2014-08-19 03:46:08 -05:00
|
|
|
'panels/graph/seriesOverridesCtrl'
|
|
|
|
], function(helpers) {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
describe('SeriesOverridesCtrl', function() {
|
|
|
|
var ctx = new helpers.ControllerTestContext();
|
2015-05-14 05:34:30 -05:00
|
|
|
var popoverSrv = {};
|
2014-08-19 03:46:08 -05:00
|
|
|
|
|
|
|
beforeEach(module('grafana.services'));
|
|
|
|
beforeEach(module('grafana.panels.graph'));
|
|
|
|
|
2015-05-14 05:34:30 -05:00
|
|
|
beforeEach(ctx.providePhase({
|
|
|
|
popoverSrv: popoverSrv
|
|
|
|
}));
|
|
|
|
|
2014-08-19 03:46:08 -05:00
|
|
|
beforeEach(ctx.createControllerPhase('SeriesOverridesCtrl'));
|
2014-08-19 09:22:18 -05:00
|
|
|
beforeEach(function() {
|
|
|
|
ctx.scope.render = function() {};
|
|
|
|
});
|
2014-08-19 03:46:08 -05:00
|
|
|
|
|
|
|
describe('When setting an override', function() {
|
|
|
|
beforeEach(function() {
|
2015-01-12 07:00:30 -06:00
|
|
|
ctx.scope.setOverride({propertyName: 'lines'}, {value: true});
|
2014-08-19 03:46:08 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should set override property', function() {
|
|
|
|
expect(ctx.scope.override.lines).to.be(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should update view model', function() {
|
|
|
|
expect(ctx.scope.currentOverrides[0].name).to.be('Lines');
|
|
|
|
expect(ctx.scope.currentOverrides[0].value).to.be('true');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-08-20 01:35:17 -05:00
|
|
|
describe('When removing overide', function() {
|
|
|
|
it('click should include option and value index', function() {
|
|
|
|
ctx.scope.setOverride(1,0);
|
|
|
|
ctx.scope.removeOverride({ propertyName: 'lines' });
|
|
|
|
expect(ctx.scope.currentOverrides.length).to.be(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-08-19 03:46:08 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|