diff --git a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx
index e89a3bcadd..e49d54b485 100644
--- a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx
+++ b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx
@@ -365,6 +365,37 @@ describe('', () => {
it('calls fetch with lowercased input and displays results', async () => {
const updateFilters = jest.fn();
+ const someOwnerEntities: Entity[] = [
+ {
+ apiVersion: '1',
+ kind: 'Group',
+ metadata: {
+ name: 'some-owner',
+ },
+ },
+ {
+ apiVersion: '1',
+ kind: 'Group',
+ metadata: {
+ name: 'some-owner-2',
+ },
+ spec: {
+ profile: {
+ displayName: 'Some Owner 2',
+ },
+ },
+ },
+ ];
+ mockCatalogApi.queryEntities.mockImplementation(async _request => {
+ const totalItems = 2;
+ return {
+ items: someOwnerEntities,
+ pageInfo: {
+ nextCursor: '',
+ },
+ totalItems,
+ };
+ });
await renderInTestApp(
', () => {
owners: undefined,
});
- fireEvent.click(screen.getByTestId('owner-picker-expand'));
- const input = screen.getByRole('textbox', { name: 'Owner' });
+ // fireEvent.click(screen.getByTestId('owner-picker-expand'));
+ const input = screen.getByRole('textbox');
fireEvent.change(input, { target: { value: 'Some-Owner' } });
await waitFor(() =>
expect(screen.getByText('some-owner')).toBeInTheDocument(),
);
+ expect(mockCatalogApi.queryEntities).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ fullTextFilter: expect.objectContaining({
+ term: 'some-owner',
+ }),
+ }),
+ );
fireEvent.click(screen.getByText('some-owner'));
expect(updateFilters).toHaveBeenLastCalledWith({
diff --git a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx
index cbfd20ad3e..ed200c77c4 100644
--- a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx
+++ b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.tsx
@@ -146,7 +146,11 @@ export const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => {
mode,
initialSelectedOwnersRefs: selectedOwners,
});
- useDebouncedEffect(() => handleFetch({ text }), [text, handleFetch], 250);
+ useDebouncedEffect(
+ () => handleFetch({ text: text.toLocaleLowerCase('en-US') }),
+ [text, handleFetch],
+ 250,
+ );
const availableOwners = value?.items || [];
@@ -221,7 +225,7 @@ export const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => {
}}
name="owner-picker"
onInputChange={(_e, inputValue) => {
- setText(inputValue.toLocaleLowerCase('en-US'));
+ setText(inputValue);
}}
ListboxProps={{
onScroll: (e: MouseEvent) => {