Add opened section (#7265)
When object is not part of the workspace favorite list, we want to show it in the "opened section" while its record page is accessed. This PR: - adds a new component `NavigationDrawerOpenedSection` - makes workflow versions and runs not system object + creates a prefilled view index for these - do not create workspace favorites for these so these do not appear in the workspace section <img width="1129" alt="Capture d’écran 2024-09-26 à 11 45 25" src="https://github.com/user-attachments/assets/c84d773c-0bef-4dce-b66a-55d7d00b0fb6">
This commit is contained in:
@ -1,40 +0,0 @@
|
||||
import * as reactRouterDom from 'react-router-dom';
|
||||
|
||||
import { useIsMenuNavbarDisplayed } from '../useIsMenuNavbarDisplayed';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
useLocation: jest.fn(),
|
||||
}));
|
||||
|
||||
const setupMockLocation = (pathname: string) => {
|
||||
jest.spyOn(reactRouterDom, 'useLocation').mockReturnValueOnce({
|
||||
pathname,
|
||||
state: undefined,
|
||||
key: '',
|
||||
search: '',
|
||||
hash: '',
|
||||
});
|
||||
};
|
||||
|
||||
describe('useIsMenuNavbarDisplayed', () => {
|
||||
it('Should return true for paths starting with "/companies"', () => {
|
||||
setupMockLocation('/companies');
|
||||
|
||||
const result = useIsMenuNavbarDisplayed();
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('Should return true for paths starting with "/companies/"', () => {
|
||||
setupMockLocation('/companies/test-some-subpath');
|
||||
|
||||
const result = useIsMenuNavbarDisplayed();
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('Should return false for paths not starting with "/companies"', () => {
|
||||
setupMockLocation('/test-path');
|
||||
|
||||
const result = useIsMenuNavbarDisplayed();
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
});
|
||||
@ -1,6 +0,0 @@
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
export const useIsMenuNavbarDisplayed = () => {
|
||||
const currentPath = useLocation().pathname;
|
||||
return currentPath.match(/^\/companies(\/.*)?$/) !== null;
|
||||
};
|
||||
Reference in New Issue
Block a user