Skip to content

Commit

Permalink
fix(AlertReports): disabling value when not null option is active (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
fisjac authored and EnxDev committed Apr 12, 2024
1 parent 845ee58 commit 1f52219
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,15 @@ test('disables condition threshold if not null condition is selected', async ()
userEvent.click(screen.getByTestId('alert-condition-panel'));
await screen.findByText(/smaller than/i);
const condition = screen.getByRole('combobox', { name: /condition/i });
const spinButton = screen.getByRole('spinbutton');
expect(spinButton).toHaveValue(10);
await comboboxSelect(
condition,
'not null',
() => screen.getAllByText(/not null/i)[0],
);
expect(screen.getByRole('spinbutton')).toBeDisabled();
expect(spinButton).toHaveValue(null);
expect(spinButton).toBeDisabled();
});

// Content Section
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,8 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
</StyledInputContainer>
<StyledInputContainer css={noMarginBottom}>
<div className="control-label">
{t('Value')} <span className="required">*</span>
{t('Value')}{' '}
{!conditionNotNull && <span className="required">*</span>}
</div>
<div className="input-container">
<input
Expand All @@ -1419,7 +1420,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
disabled={conditionNotNull}
value={
currentAlert?.validator_config_json?.threshold !==
undefined
undefined && !conditionNotNull
? currentAlert.validator_config_json.threshold
: ''
}
Expand Down

0 comments on commit 1f52219

Please sign in to comment.