mirror of
https://github.com/apache/superset.git
synced 2026-06-02 06:09:21 +00:00
fix(time-series table): Can't compare from the beginning of the time range (#26814)
This commit is contained in:
committed by
GitHub
parent
c657745f02
commit
1f6c270f15
@@ -104,6 +104,19 @@ test('triggers onChange when time lag changes', () => {
|
||||
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ timeLag }));
|
||||
});
|
||||
|
||||
test('time lag allows negative values', () => {
|
||||
const timeLag = '-1';
|
||||
const onChange = jest.fn();
|
||||
render(<TimeSeriesColumnControl colType="time" onChange={onChange} />);
|
||||
userEvent.click(screen.getByRole('button'));
|
||||
const timeLagInput = screen.getByPlaceholderText('Time Lag');
|
||||
userEvent.clear(timeLagInput);
|
||||
userEvent.type(timeLagInput, timeLag);
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
userEvent.click(screen.getByRole('button', { name: 'Save' }));
|
||||
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ timeLag }));
|
||||
});
|
||||
|
||||
test('triggers onChange when color bounds changes', () => {
|
||||
const min = 1;
|
||||
const max = 5;
|
||||
|
||||
@@ -248,7 +248,9 @@ export default class TimeSeriesColumnControl extends React.Component {
|
||||
{['time', 'avg'].indexOf(this.state.colType) >= 0 &&
|
||||
this.formRow(
|
||||
t('Time lag'),
|
||||
t('Number of periods to compare against'),
|
||||
t(
|
||||
'Number of periods to compare against. You can use negative numbers to compare from the beginning of the time range.',
|
||||
),
|
||||
'time-lag',
|
||||
<Input
|
||||
value={this.state.timeLag}
|
||||
|
||||
Reference in New Issue
Block a user