Chore: Suppress messages and logs from tests (#44629)

* Suppress "not wrapped in act()" warning in UserPicker test

* Add menuShouldPortal to AmRoutesExpandedForm to suppress deprecation warning

* use forwardRef in alerting ActionIcon to suppress ref warning

* Add menuShouldPortal to alerting GroupBy to suppress deprecation warning
pull/39088/head
Josh Hunt 3 years ago committed by GitHub
parent df8e377b5e
commit de7a920967
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      public/app/core/components/Select/UserPicker.test.tsx
  2. 1
      public/app/features/alerting/unified/components/alert-groups/GroupBy.tsx
  3. 1
      public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx
  4. 11
      public/app/features/alerting/unified/components/rules/ActionIcon.tsx

@ -7,8 +7,9 @@ jest.mock('@grafana/runtime', () => ({
}));
describe('UserPicker', () => {
it('renders correctly', () => {
it('renders correctly', async () => {
render(<UserPicker onSelected={() => {}} />);
expect(screen.getByTestId('userPicker')).toBeInTheDocument();
expect(await screen.findByTestId('userPicker')).toBeInTheDocument();
});
});

@ -31,6 +31,7 @@ export const GroupBy = ({ className, groups, groupBy, onGroupingChange }: Props)
onGroupingChange(items.map(({ value }) => value as string));
}}
options={labelKeyOptions}
menuShouldPortal
/>
</div>
);

@ -82,6 +82,7 @@ export const AmRoutesExpandedForm: FC<AmRoutesExpandedFormProps> = ({ onCancel,
onChange={(value) => onChange(value?.value)}
options={matcherFieldOptions}
aria-label="Operator"
menuShouldPortal
/>
)}
defaultValue={field.operator}

@ -56,21 +56,24 @@ interface GoToProps {
url: string;
label?: string;
target?: string;
children?: React.ReactNode;
}
const GoTo: FC<GoToProps> = ({ url, label, target, children }) => {
const GoTo = React.forwardRef<HTMLAnchorElement, GoToProps>(({ url, label, target, children }, ref) => {
const absoluteUrl = url?.startsWith('http');
return absoluteUrl ? (
<a aria-label={label} href={url} target={target}>
<a ref={ref} aria-label={label} href={url} target={target}>
{children}
</a>
) : (
<Link aria-label={label} to={url} target={target}>
<Link ref={ref} aria-label={label} to={url} target={target}>
{children}
</Link>
);
};
});
GoTo.displayName = 'GoTo';
export const getStyle = () => css`
cursor: pointer;

Loading…
Cancel
Save