Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbondyra committed Sep 30, 2020
1 parent 3da0ad1 commit 572ffa7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ describe('ValuesRangeInput', () => {
instance.update();
expect(instance.find(EuiRange).prop('value')).toEqual('107');
// useDebounce only runs on initialization
expect(onChangeSpy.mock.calls.length).toBe(1);
expect(onChangeSpy.mock.calls.length).toBe(2);
expect(onChangeSpy.mock.calls[0][0]).toBe(5);
expect(onChangeSpy.mock.calls[1][0]).toBe(100);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ import { useDebounce } from 'react-use';
import { i18n } from '@kbn/i18n';
import { EuiRange } from '@elastic/eui';

type PropType<C> = C extends React.ComponentType<infer P> ? P : unknown;
// Add ticks to EuiRange component props
const FixedEuiRange = (EuiRange as unknown) as React.ComponentType<
PropType<typeof EuiRange> & {
ticks?: Array<{
label: string;
value: number;
}>;
}
>;

export const ValuesRangeInput = ({
value,
onChange,
Expand All @@ -44,7 +33,7 @@ export const ValuesRangeInput = ({
);

return (
<FixedEuiRange
<EuiRange
min={MIN_NUMBER_OF_VALUES}
max={MAX_NUMBER_OF_VALUES}
step={1}
Expand Down

0 comments on commit 572ffa7

Please sign in to comment.