Commit 31b12033 by Torkel Ödegaard

fixed failing unit test

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