Merge pull request #25611 from RikClaessens/use-search-icon

Update the SearchBar to make use of the useApp hook to retrieve the search icon specified in the createApp call
This commit is contained in:
Fredrik Adelöw
2024-08-21 10:47:05 +02:00
committed by GitHub
9 changed files with 110 additions and 43 deletions
+5
View File
@@ -8,6 +8,7 @@ import { AnalyticsEvent } from '@backstage/core-plugin-api';
import { ApiHolder } from '@backstage/core-plugin-api';
import { ApiRef } from '@backstage/core-plugin-api';
import { AppComponents } from '@backstage/core-plugin-api';
import { AppIcons } from '@backstage/core-app-api';
import { AuthorizeResult } from '@backstage/plugin-permission-common';
import { ComponentType } from 'react';
import { Config } from '@backstage/config';
@@ -21,6 +22,7 @@ import { EvaluatePermissionRequest } from '@backstage/plugin-permission-common';
import { EvaluatePermissionResponse } from '@backstage/plugin-permission-common';
import { ExternalRouteRef } from '@backstage/core-plugin-api';
import { FetchApi } from '@backstage/core-plugin-api';
import { IconComponent } from '@backstage/core-plugin-api';
import { IdentityApi } from '@backstage/core-plugin-api';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
@@ -252,6 +254,9 @@ export type TestAppOptions = {
[path: string]: RouteRef | ExternalRouteRef;
};
components?: Partial<AppComponents>;
icons?: Partial<AppIcons> & {
[key in string]: IconComponent;
};
};
// @public
@@ -23,13 +23,14 @@ import React, {
import { MemoryRouter, Route } from 'react-router-dom';
import { themes, UnifiedThemeProvider } from '@backstage/theme';
import MockIcon from '@material-ui/icons/AcUnit';
import { createSpecializedApp } from '@backstage/core-app-api';
import { AppIcons, createSpecializedApp } from '@backstage/core-app-api';
import {
AppComponents,
attachComponentData,
BootErrorPageProps,
createRouteRef,
ExternalRouteRef,
IconComponent,
RouteRef,
} from '@backstage/core-plugin-api';
import { MatcherFunction, RenderResult } from '@testing-library/react';
@@ -107,6 +108,13 @@ export type TestAppOptions = {
* Components to be forwarded to the `components` option of `createApp`.
*/
components?: Partial<AppComponents>;
/**
* Icons to be forwarded to the `icons` option of `createApp`.
*/
icons?: Partial<AppIcons> & {
[key in string]: IconComponent;
};
};
function isExternalRouteRef(
@@ -145,7 +153,10 @@ export function createTestAppWrapper(
),
...options.components,
},
icons: mockIcons,
icons: {
...mockIcons,
...options.icons,
},
plugins: [],
themes: [
{