Skip to content

Commit

Permalink
[Lens] Set top values limit to 10,000 (#136399)
Browse files Browse the repository at this point in the history
* bump top values limit

* fix tests
  • Loading branch information
flash1293 authored Jul 18, 2022
1 parent a5738e9 commit 46be036
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ describe('Values', () => {
expect(onChangeSpy.mock.calls[0][0]).toBe(7);
});

it('should not run onChange function on update when value is out of 1-1000 range', () => {
it('should not run onChange function on update when value is out of 1-10000 range', () => {
const onChangeSpy = jest.fn();
const instance = shallow(<ValuesInput value={5} onChange={onChangeSpy} />);
act(() => {
instance.find(EuiFieldNumber).simulate('change', { currentTarget: { value: '1007' } });
instance.find(EuiFieldNumber).simulate('change', { currentTarget: { value: '10007' } });
});
instance.update();
expect(instance.find(EuiFieldNumber).prop('value')).toEqual('1007');
expect(instance.find(EuiFieldNumber).prop('value')).toEqual('10007');
expect(onChangeSpy.mock.calls.length).toBe(1);
expect(onChangeSpy.mock.calls[0][0]).toBe(1000);
expect(onChangeSpy.mock.calls[0][0]).toBe(10000);
});

it('should show an error message when the value is out of bounds', () => {
Expand All @@ -60,7 +60,7 @@ describe('Values', () => {
);

act(() => {
instance.find(EuiFieldNumber).simulate('change', { currentTarget: { value: '1007' } });
instance.find(EuiFieldNumber).simulate('change', { currentTarget: { value: '10007' } });
});
instance.update();

Expand Down Expand Up @@ -91,10 +91,10 @@ describe('Values', () => {
expect(instance.find(EuiFieldNumber).prop('isInvalid')).toBeFalsy();
expect(instance.find(EuiFieldNumber).prop('value')).toBe('1');

changeAndBlur('5000');
changeAndBlur('50000');

expect(instance.find(EuiFieldNumber).prop('isInvalid')).toBeFalsy();
expect(instance.find(EuiFieldNumber).prop('value')).toBe('1000');
expect(instance.find(EuiFieldNumber).prop('value')).toBe('10000');

changeAndBlur('');
// as we're not handling the onChange state, it fallbacks to the value prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const ValuesInput = ({
value,
onChange,
minValue = 1,
maxValue = 1000,
maxValue = 10000,
label = i18n.translate('xpack.lens.indexPattern.terms.size', {
defaultMessage: 'Number of values',
}),
Expand Down

0 comments on commit 46be036

Please sign in to comment.