graph_ctrl_specs.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ///<reference path="../../../../headers/common.d.ts" />
  2. import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
  3. import angular from 'angular';
  4. import {GraphCtrl} from '../module';
  5. import helpers from '../../../../../test/specs/helpers';
  6. describe('GraphCtrl', function() {
  7. var ctx = new helpers.ControllerTestContext();
  8. beforeEach(angularMocks.module('grafana.services'));
  9. beforeEach(angularMocks.module('grafana.controllers'));
  10. beforeEach(ctx.providePhase());
  11. beforeEach(ctx.createPanelController(GraphCtrl));
  12. beforeEach(() => {
  13. ctx.ctrl.annotationsPromise = Promise.resolve({});
  14. ctx.ctrl.updateTimeRange();
  15. });
  16. describe.skip('msResolution with second resolution timestamps', function() {
  17. beforeEach(function() {
  18. var data = [
  19. { target: 'test.cpu1', datapoints: [[45, 1234567890], [60, 1234567899]]},
  20. { target: 'test.cpu2', datapoints: [[55, 1236547890], [90, 1234456709]]}
  21. ];
  22. ctx.ctrl.panel.tooltip.msResolution = false;
  23. ctx.ctrl.onDataReceived(data);
  24. });
  25. it('should not show millisecond resolution tooltip', function() {
  26. expect(ctx.ctrl.panel.tooltip.msResolution).to.be(false);
  27. });
  28. });
  29. describe.skip('msResolution with millisecond resolution timestamps', function() {
  30. beforeEach(function() {
  31. var data = [
  32. { target: 'test.cpu1', datapoints: [[45, 1234567890000], [60, 1234567899000]]},
  33. { target: 'test.cpu2', datapoints: [[55, 1236547890001], [90, 1234456709000]]}
  34. ];
  35. ctx.ctrl.panel.tooltip.msResolution = false;
  36. ctx.ctrl.onDataReceived(data);
  37. });
  38. it('should show millisecond resolution tooltip', function() {
  39. expect(ctx.ctrl.panel.tooltip.msResolution).to.be(true);
  40. });
  41. });
  42. describe.skip('msResolution with millisecond resolution timestamps but with trailing zeroes', function() {
  43. beforeEach(function() {
  44. var data = [
  45. { target: 'test.cpu1', datapoints: [[45, 1234567890000], [60, 1234567899000]]},
  46. { target: 'test.cpu2', datapoints: [[55, 1236547890000], [90, 1234456709000]]}
  47. ];
  48. ctx.ctrl.panel.tooltip.msResolution = false;
  49. ctx.ctrl.onDataReceived(data);
  50. });
  51. it('should not show millisecond resolution tooltip', function() {
  52. expect(ctx.ctrl.panel.tooltip.msResolution).to.be(false);
  53. });
  54. });
  55. describe.skip('msResolution with millisecond resolution timestamps in one of the series', function() {
  56. beforeEach(function() {
  57. var data = [
  58. { target: 'test.cpu1', datapoints: [[45, 1234567890000], [60, 1234567899000]]},
  59. { target: 'test.cpu2', datapoints: [[55, 1236547890010], [90, 1234456709000]]},
  60. { target: 'test.cpu3', datapoints: [[65, 1236547890000], [120, 1234456709000]]}
  61. ];
  62. ctx.ctrl.panel.tooltip.msResolution = false;
  63. ctx.ctrl.onDataReceived(data);
  64. });
  65. it('should show millisecond resolution tooltip', function() {
  66. expect(ctx.ctrl.panel.tooltip.msResolution).to.be(true);
  67. });
  68. });
  69. });