Commit dcea2c5f by Harald Kraemer

Fixed last test + a mistake in other tests setup

 - filterSrv expects the parameter to init to be the actual
   dashboard object (I'll depend on that later on), so
   I had to pass dashboard.current in there, instead of
   dashboard
 - in the last test, the problem was exactly that again.
parent ed76d718
......@@ -21,7 +21,7 @@ define([
describe('init', function() {
beforeEach(function() {
_filterSrv.init( _dashboard );
_filterSrv.init( _dashboard.current );
_filterSrv.addTemplateParameter({ name: 'test', current: { value: 'oogle' } });
});
......@@ -33,7 +33,7 @@ define([
describe('templateOptionSelected', function() {
beforeEach(function() {
_filterSrv.init( _dashboard );
_filterSrv.init( _dashboard.current );
_filterSrv.addTemplateParameter({ name: 'test' });
_filterSrv.templateOptionSelected(_filterSrv.templateParameters[0], { value: 'muuuu' });
});
......@@ -45,7 +45,7 @@ define([
describe('timeRange', function() {
it('should return unparsed when parse is false', function() {
_filterSrv.init( _dashboard );
_filterSrv.init( _dashboard.current );
_filterSrv.setTime({from: 'now', to: 'now-1h' });
var time = _filterSrv.timeRange(false);
expect(time.from).to.be('now');
......@@ -53,7 +53,7 @@ define([
});
it('should return parsed when parse is true', function() {
_filterSrv.init( _dashboard );
_filterSrv.init( _dashboard.current );
_filterSrv.setTime({from: 'now', to: 'now-1h' });
var time = _filterSrv.timeRange(true);
expect(_.isDate(time.from)).to.be(true);
......@@ -63,7 +63,7 @@ define([
describe('setTime', function() {
it('should return disable refresh for absolute times', function() {
_filterSrv.init( _dashboard );
_filterSrv.init( _dashboard.current );
_dashboard.current.refresh = true;
_filterSrv.setTime({from: '2011-01-01', to: '2015-01-01' });
......@@ -71,6 +71,7 @@ define([
});
it('should restore refresh after relative time range is set', function() {
_filterSrv.init( _dashboard.current );
_dashboard.current.refresh = true;
_filterSrv.setTime({from: '2011-01-01', to: '2015-01-01' });
expect(_dashboard.current.refresh).to.be(false);
......
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