diff --git a/awx/ui_next/src/components/Search/Search.test.jsx b/awx/ui_next/src/components/Search/Search.test.jsx
index e896fcdb37..32c2548a35 100644
--- a/awx/ui_next/src/components/Search/Search.test.jsx
+++ b/awx/ui_next/src/components/Search/Search.test.jsx
@@ -93,6 +93,52 @@ describe('', () => {
expect(onSearch).toBeCalledWith('description__icontains', 'test-321');
});
+ test('changing key select to and from advanced causes onShowAdvancedSearch callback to be invoked', () => {
+ const searchButton = 'button[aria-label="Search submit button"]';
+ const searchTextInput = 'input[aria-label="Search text input"]';
+ const columns = [
+ { name: 'Name', key: 'name__icontains', isDefault: true },
+ { name: 'Description', key: 'description__icontains' },
+ { name: 'Advanced', key: 'advanced' },
+ ];
+ const onSearch = jest.fn();
+ const onShowAdvancedSearch = jest.fn();
+ const wrapper = mountWithContexts(
+ {}}
+ collapseListedFiltersBreakpoint="lg"
+ >
+
+
+
+
+ );
+
+ act(() => {
+ wrapper
+ .find('Select[aria-label="Simple key select"]')
+ .invoke('onSelect')({ target: { innerText: 'Advanced' } });
+ });
+ wrapper.update();
+ expect(onShowAdvancedSearch).toHaveBeenCalledTimes(1);
+ expect(onShowAdvancedSearch).toBeCalledWith(true);
+ jest.clearAllMocks();
+ act(() => {
+ wrapper
+ .find('Select[aria-label="Simple key select"]')
+ .invoke('onSelect')({ target: { innerText: 'Description' } });
+ });
+ wrapper.update();
+ expect(onShowAdvancedSearch).toHaveBeenCalledTimes(1);
+ expect(onShowAdvancedSearch).toBeCalledWith(false);
+ });
+
test('attempt to search with empty string', () => {
const searchButton = 'button[aria-label="Search submit button"]';
const searchTextInput = 'input[aria-label="Search text input"]';