[Lens] Do not reset formatting when switching between custom ranges and auto histogram (#82694)
This commit is contained in:
parent
1de3a02a46
commit
0503f873f8
|
@ -744,6 +744,36 @@ describe('ranges', () => {
|
|||
/^Bytes format:/
|
||||
);
|
||||
});
|
||||
|
||||
it('should not reset formatters when switching between custom ranges and auto histogram', () => {
|
||||
const setStateSpy = jest.fn();
|
||||
// now set a format on the range operation
|
||||
(state.layers.first.columns.col1 as RangeIndexPatternColumn).params.format = {
|
||||
id: 'custom',
|
||||
params: { decimals: 3 },
|
||||
};
|
||||
|
||||
const instance = mount(
|
||||
<InlineOptions
|
||||
{...defaultOptions}
|
||||
state={state}
|
||||
setState={setStateSpy}
|
||||
columnId="col1"
|
||||
currentColumn={state.layers.first.columns.col1 as RangeIndexPatternColumn}
|
||||
layerId="first"
|
||||
/>
|
||||
);
|
||||
|
||||
// This series of act closures are made to make it work properly the update flush
|
||||
act(() => {
|
||||
instance.find(EuiLink).first().prop('onClick')!({} as ReactMouseEvent);
|
||||
});
|
||||
|
||||
expect(setStateSpy.mock.calls[1][0].layers.first.columns.col1.params.format).toEqual({
|
||||
id: 'custom',
|
||||
params: { decimals: 3 },
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -225,7 +225,7 @@ export const rangeOperation: OperationDefinition<RangeIndexPatternColumn, 'field
|
|||
type: newMode,
|
||||
ranges: [{ from: 0, to: DEFAULT_INTERVAL, label: '' }],
|
||||
maxBars: maxBarsDefaultValue,
|
||||
format: undefined,
|
||||
format: currentColumn.params.format,
|
||||
parentFormat,
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue