Commit 31b12033 by Torkel Ödegaard

fixed failing unit test

parent 4562f31b
......@@ -5,10 +5,9 @@ define([],
return {
create: function() {
return {
refresh: function() {},
set_interval: function(value) { this.current.refresh = value; },
emit_refresh: function() {},
set_interval: function(value) { this.refresh = value; },
current: {
title: "",
tags: [],
style: "dark",
......@@ -19,7 +18,12 @@ define([],
rows: [],
pulldowns: [ { type: 'templating' }, { type: 'annotations' } ],
nav: [ { type: 'timepicker' } ],
services: {},
services: {
filter: {
time: {},
list: []
}
},
loader: {
save_gist: false,
save_elasticsearch: true,
......@@ -35,7 +39,6 @@ define([],
hide: false
},
refresh: true
}
};
}
};
......
......@@ -12,7 +12,6 @@ define([
beforeEach(module('kibana.services'));
beforeEach(module(function($provide){
_dashboard = dashboardMock.create();
$provide.value('dashboard', _dashboard);
}));
beforeEach(inject(function(filterSrv) {
......@@ -20,7 +19,7 @@ define([
}));
beforeEach(function() {
_filterSrv.init(_dashboard.current);
_filterSrv.init(_dashboard);
});
describe('init', function() {
......@@ -68,18 +67,18 @@ define([
describe('setTime', function() {
it('should return disable refresh for absolute times', function() {
_dashboard.current.refresh = true;
_dashboard.refresh = true;
_filterSrv.setTime({from: '2011-01-01', to: '2015-01-01' });
expect(_dashboard.current.refresh).to.be(false);
expect(_dashboard.refresh).to.be(false);
});
it('should restore refresh after relative time range is set', function() {
_dashboard.current.refresh = true;
_dashboard.refresh = true;
_filterSrv.setTime({from: '2011-01-01', to: '2015-01-01' });
expect(_dashboard.current.refresh).to.be(false);
expect(_dashboard.refresh).to.be(false);
_filterSrv.setTime({from: '2011-01-01', to: 'now' });
expect(_dashboard.current.refresh).to.be(true);
expect(_dashboard.refresh).to.be(true);
});
});
......
......@@ -104,7 +104,6 @@ require([
'angularMocks',
'jquery',
'underscore',
'elasticjs',
'bootstrap',
'angular-sanitize',
'angular-strap',
......
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