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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user