From 70de933e56739a231c0462fd570d52630aed55ce Mon Sep 17 00:00:00 2001 From: sjeyaraman Date: Sun, 5 Jun 2022 12:40:43 -0700 Subject: [PATCH] customize unregister entity menuitem Signed-off-by: sjeyaraman --- .../EntityContextMenu.test.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.test.tsx b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.test.tsx index 5d995828e6..9906cd9c12 100644 --- a/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.test.tsx +++ b/plugins/catalog/src/components/EntityContextMenu/EntityContextMenu.test.tsx @@ -60,6 +60,30 @@ describe('ComponentContextMenu', () => { expect(mockCallback).toBeCalled(); }); + it('check Unregister entity button is disabled', async () => { + const mockCallback = jest.fn(); + + const { getByText } = await render( + {}} + />, + ); + + const button = await screen.findByTestId('menu-button'); + expect(button).toBeInTheDocument(); + fireEvent.click(button); + + const unregister = await screen.getByText('Unregister entity'); + expect(unregister).toBeInTheDocument(); + + const unregisterSpanItem = getByText(/Unregister entity/); + const unregisterMenuListItem = + unregisterSpanItem?.parentElement?.parentElement; + expect(unregisterMenuListItem).toHaveAttribute('aria-disabled'); + }); + it('should call onInspectEntity on button click', async () => { const mockCallback = jest.fn();