Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Set top values limit to 10,000 #136399

Merged
merged 3 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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