Skip to content

Commit

Permalink
tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Feb 16, 2023
1 parent 7abb62a commit 0f1a68b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ const shouldRefreshFilterCompareOptions = {

export const shouldRefreshDiffingFunctions: DashboardDiffFunctions = {
...unsavedChangesDiffingFunctions,
filters: ({ currentValue, lastValue }) =>
filters: ({ currentValue, lastValue }) =>
onlyDisabledFiltersChanged(lastValue, currentValue, shouldRefreshFilterCompareOptions),
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
*/

import { buildExistsFilter, disableFilter, pinFilter, toggleFilterNegated } from '@kbn/es-query';
import type { DataViewFieldBase, DataViewBase } from '@kbn/es-query';
import { getShouldRefresh } from './dashboard_diffing_integration';
import { DashboardContainer } from '../../dashboard_container';
import { DashboardContainerByValueInput } from '../../../../../common';

describe('getShouldRefresh', () => {
const dashboardContainerMock = {
Expand All @@ -28,10 +30,10 @@ describe('getShouldRefresh', () => {
const pinnedFilter = pinFilter(existsFilter);
const lastInput = {
filters: [pinnedFilter],
};
} as unknown as DashboardContainerByValueInput;
const input = {
filters: [toggleFilterNegated(pinnedFilter)],
};
} as unknown as DashboardContainerByValueInput;
expect(await getShouldRefresh.bind(dashboardContainerMock)(lastInput, { ...lastInput })).toBe(
false
);
Expand All @@ -42,20 +44,20 @@ describe('getShouldRefresh', () => {
const disabledFilter = disableFilter(existsFilter);
const lastInput = {
filters: [disabledFilter],
};
} as unknown as DashboardContainerByValueInput;
const input = {
filters: [toggleFilterNegated(disabledFilter)],
};
} as unknown as DashboardContainerByValueInput;
expect(await getShouldRefresh.bind(dashboardContainerMock)(lastInput, input)).toBe(false);
});

test('should return false when pinned filter changes to unpinned', async () => {
const lastInput = {
filters: [existsFilter],
};
} as unknown as DashboardContainerByValueInput;
const input = {
filters: [pinFilter(existsFilter)],
};
} as unknown as DashboardContainerByValueInput;
expect(await getShouldRefresh.bind(dashboardContainerMock)(lastInput, input)).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DashboardContainer } from '../../dashboard_container';
import { pluginServices } from '../../../../services/plugin_services';
import { DashboardContainerByValueInput } from '../../../../../common';
import { CHANGE_CHECK_DEBOUNCE } from '../../../../dashboard_constants';
import type { DashboardDiffFunctions } from './dashboard_diffing_functions';
import {
isKeyEqual,
shouldRefreshDiffingFunctions,
Expand Down Expand Up @@ -178,7 +179,7 @@ export async function getShouldRefresh(
this: DashboardContainer,
lastInput: DashboardContainerByValueInput,
input: DashboardContainerByValueInput
): Promise<Partial<DashboardContainerByValueInput>> {
): Promise<boolean> {
const inputChanges = await getInputChanges(
this,
lastInput,
Expand Down

0 comments on commit 0f1a68b

Please sign in to comment.