Commit 993a2dac by Torkel Ödegaard

fixed failing unit test, added 2 more for setTime & auto refresh behavior

parent 541baac4
......@@ -6,6 +6,7 @@ define([],
create: function() {
return {
refresh: function() {},
set_interval: function(value) { this.current.refresh = value; },
current: {
title: "",
......@@ -33,7 +34,7 @@ define([],
load_local: false,
hide: false
},
refresh: false
refresh: true
}
};
}
......
......@@ -7,10 +7,12 @@ define([
describe('filterSrv', function() {
var _filterSrv;
var _dashboard;
beforeEach(module('kibana.services'));
beforeEach(module(function($provide){
$provide.value('dashboard', dashboardMock.create());
_dashboard = dashboardMock.create();
$provide.value('dashboard', _dashboard);
}));
beforeEach(inject(function(filterSrv) {
......@@ -56,6 +58,23 @@ define([
});
});
describe('setTime', function() {
it('should return disable refresh for absolute times', function() {
_dashboard.current.refresh = true;
_filterSrv.setTime({from: '2011-01-01', to: '2015-01-01' });
expect(_dashboard.current.refresh).to.be(false);
});
it('should restore refresh after relative time range is set', function() {
_dashboard.current.refresh = true;
_filterSrv.setTime({from: '2011-01-01', to: '2015-01-01' });
expect(_dashboard.current.refresh).to.be(false);
_filterSrv.setTime({from: '2011-01-01', to: 'now' });
expect(_dashboard.current.refresh).to.be(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