mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* set pause to 'true' when refresh interval is zero * keep original assertion * fix expect message in functional tests now that pause is set to true * fix executorProvider mocha test
This commit is contained in:
parent
367320c1f4
commit
08e8a66f31
5 changed files with 20 additions and 5 deletions
|
@ -76,8 +76,9 @@ class Timefilter extends SimpleEmitter {
|
|||
setRefreshInterval = (refreshInterval) => {
|
||||
// Object.assign used for partially composed updates
|
||||
const newRefreshInterval = Object.assign(this.getRefreshInterval(), refreshInterval);
|
||||
if (newRefreshInterval.value < 0) {
|
||||
if (newRefreshInterval.value <= 0) {
|
||||
newRefreshInterval.value = 0;
|
||||
newRefreshInterval.pause = true;
|
||||
}
|
||||
if (areTimePickerValsDifferent(this.getRefreshInterval(), newRefreshInterval)) {
|
||||
this._refreshInterval = {
|
||||
|
|
|
@ -131,7 +131,17 @@ describe('setRefreshInterval', () => {
|
|||
|
||||
test('should allow partial updates to refresh interval', () => {
|
||||
timefilter.setRefreshInterval({ value: 10 });
|
||||
expect(timefilter.getRefreshInterval()).to.eql({ pause: false, value: 10 });
|
||||
expect(timefilter.getRefreshInterval()).to.eql({ pause: true, value: 10 });
|
||||
});
|
||||
|
||||
test('should not allow negative intervals', () => {
|
||||
timefilter.setRefreshInterval({ value: -10 });
|
||||
expect(timefilter.getRefreshInterval()).to.eql({ pause: true, value: 0 });
|
||||
});
|
||||
|
||||
test('should set pause to true when interval is zero', () => {
|
||||
timefilter.setRefreshInterval({ value: 0, pause: false });
|
||||
expect(timefilter.getRefreshInterval()).to.eql({ pause: true, value: 0 });
|
||||
});
|
||||
|
||||
test('not emit anything if nothing has changed', () => {
|
||||
|
|
|
@ -29,7 +29,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
let kibanaBaseUrl;
|
||||
|
||||
const urlQuery = `` +
|
||||
`_g=(refreshInterval:(pause:!f,value:0),` +
|
||||
`_g=(refreshInterval:(pause:!t,value:0),` +
|
||||
`time:(from:'2012-11-17T00:00:00.000Z',mode:absolute,to:'2015-11-17T18:01:36.621Z'))&` +
|
||||
`_a=(description:'',filters:!(),` +
|
||||
`fullScreenMode:!f,` +
|
||||
|
|
|
@ -76,7 +76,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const expectedUrl =
|
||||
baseUrl +
|
||||
'/app/kibana?_t=1453775307251#' +
|
||||
'/discover?_g=(refreshInterval:(pause:!f,value:0),time' +
|
||||
'/discover?_g=(refreshInterval:(pause:!t,value:0),time' +
|
||||
':(from:\'2015-09-19T06:31:44.000Z\',mode:absolute,to:\'2015-09' +
|
||||
'-23T18:31:44.000Z\'))&_a=(columns:!(_source),index:\'logstash-' +
|
||||
'*\',interval:auto,query:(language:lucene,query:\'\')' +
|
||||
|
|
|
@ -29,7 +29,6 @@ describe('$executor service', () => {
|
|||
$timeout.cancel = (id) => clearTimeout(id);
|
||||
|
||||
timefilter.setRefreshInterval({
|
||||
pause: false,
|
||||
value: 0
|
||||
});
|
||||
|
||||
|
@ -63,6 +62,7 @@ describe('$executor service', () => {
|
|||
|
||||
it('should call $timeout if the timefilter is not paused and set to 1000ms', () => {
|
||||
timefilter.setRefreshInterval({
|
||||
pause: false,
|
||||
value: 1000
|
||||
});
|
||||
executor.start(scope);
|
||||
|
@ -71,6 +71,7 @@ describe('$executor service', () => {
|
|||
|
||||
it('should execute function if timefilter is not paused and interval set to 1000ms', (done) => {
|
||||
timefilter.setRefreshInterval({
|
||||
pause: false,
|
||||
value: 1000
|
||||
});
|
||||
executor.register({ execute: () => Promise.resolve().then(() => done(), done) });
|
||||
|
@ -80,6 +81,7 @@ describe('$executor service', () => {
|
|||
it('should execute function multiple times', (done) => {
|
||||
let calls = 0;
|
||||
timefilter.setRefreshInterval({
|
||||
pause: false,
|
||||
value: 10
|
||||
});
|
||||
executor.register({ execute: () => {
|
||||
|
@ -91,6 +93,7 @@ describe('$executor service', () => {
|
|||
|
||||
it('should call handleResponse', (done) => {
|
||||
timefilter.setRefreshInterval({
|
||||
pause: false,
|
||||
value: 10
|
||||
});
|
||||
executor.register({
|
||||
|
@ -102,6 +105,7 @@ describe('$executor service', () => {
|
|||
|
||||
it('should call handleError', (done) => {
|
||||
timefilter.setRefreshInterval({
|
||||
pause: false,
|
||||
value: 10
|
||||
});
|
||||
executor.register({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue