mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix for SharePanelCtrl-specs and travis-ci timezone issue
This commit is contained in:
parent
282c834d9f
commit
2e9cc2a74e
@ -1,8 +1,7 @@
|
|||||||
define([
|
define([
|
||||||
'./helpers',
|
'./helpers',
|
||||||
'moment',
|
|
||||||
'controllers/sharePanelCtrl'
|
'controllers/sharePanelCtrl'
|
||||||
], function(helpers, moment) {
|
], function(helpers) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
describe('SharePanelCtrl', function() {
|
describe('SharePanelCtrl', function() {
|
||||||
@ -13,10 +12,6 @@ define([
|
|||||||
beforeEach(ctx.providePhase());
|
beforeEach(ctx.providePhase());
|
||||||
beforeEach(ctx.createControllerPhase('SharePanelCtrl'));
|
beforeEach(ctx.createControllerPhase('SharePanelCtrl'));
|
||||||
|
|
||||||
function getDate(year, month, day) {
|
|
||||||
return moment.utc(new Date(year, month, day)).toDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('shareUrl with current time range and panel', function() {
|
describe('shareUrl with current time range and panel', function() {
|
||||||
|
|
||||||
it('should generate share url relative time', function() {
|
it('should generate share url relative time', function() {
|
||||||
@ -31,16 +26,16 @@ define([
|
|||||||
it('should generate share url absolute time', function() {
|
it('should generate share url absolute time', function() {
|
||||||
ctx.$location.path('/test');
|
ctx.$location.path('/test');
|
||||||
ctx.scope.panel = { id: 22 };
|
ctx.scope.panel = { id: 22 };
|
||||||
ctx.timeSrv.time = { from: getDate(2012,1,1), to: new Date(2014,3,5) };
|
ctx.timeSrv.time = { from: new Date(1362178800000), to: new Date(1396648800000) };
|
||||||
|
|
||||||
ctx.scope.buildUrl();
|
ctx.scope.buildUrl();
|
||||||
expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1328050800000&to=1396648800000&panelId=22&fullscreen');
|
expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1362178800000&to=1396648800000&panelId=22&fullscreen');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate share url with time as JSON strings', function() {
|
it('should generate share url with time as JSON strings', function() {
|
||||||
ctx.$location.path('/test');
|
ctx.$location.path('/test');
|
||||||
ctx.scope.panel = { id: 22 };
|
ctx.scope.panel = { id: 22 };
|
||||||
ctx.timeSrv.time = { from: new Date(2012,1,1).toJSON(), to: new Date(2014,3,5).toJSON() };
|
ctx.timeSrv.time = { from: "2012-01-31T23:00:00.000Z", to: "2014-04-04T22:00:00.000Z" };
|
||||||
|
|
||||||
ctx.scope.buildUrl();
|
ctx.scope.buildUrl();
|
||||||
expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1328050800000&to=1396648800000&panelId=22&fullscreen');
|
expect(ctx.scope.shareUrl).to.be('http://server/#/test?from=1328050800000&to=1396648800000&panelId=22&fullscreen');
|
||||||
|
Loading…
Reference in New Issue
Block a user