seriesOverridesCtrl-specs.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. define([
  2. 'helpers',
  3. 'panels/graph/seriesOverridesCtrl'
  4. ], function(helpers) {
  5. 'use strict';
  6. describe('SeriesOverridesCtrl', function() {
  7. var ctx = new helpers.ControllerTestContext();
  8. beforeEach(module('grafana.services'));
  9. beforeEach(module('grafana.panels.graph'));
  10. beforeEach(ctx.providePhase());
  11. beforeEach(ctx.createControllerPhase('SeriesOverridesCtrl'));
  12. beforeEach(function() {
  13. ctx.scope.render = function() {};
  14. });
  15. describe('When setting an override', function() {
  16. beforeEach(function() {
  17. ctx.scope.setOverride({propertyName: 'lines'}, {value: true});
  18. });
  19. it('should set override property', function() {
  20. expect(ctx.scope.override.lines).to.be(true);
  21. });
  22. it('should update view model', function() {
  23. expect(ctx.scope.currentOverrides[0].name).to.be('Lines');
  24. expect(ctx.scope.currentOverrides[0].value).to.be('true');
  25. });
  26. });
  27. describe('When removing overide', function() {
  28. it('click should include option and value index', function() {
  29. ctx.scope.setOverride(1,0);
  30. ctx.scope.removeOverride({ propertyName: 'lines' });
  31. expect(ctx.scope.currentOverrides.length).to.be(0);
  32. });
  33. });
  34. });
  35. });