fix(editor): Address folders feature feedback (no-changelog) (#13859)

This commit is contained in:
Milorad FIlipović
2025-03-13 17:29:15 +01:00
committed by GitHub
parent b4672b8deb
commit 31493a0cac
17 changed files with 189 additions and 298 deletions

View File

@@ -44,25 +44,6 @@ const DEFAULT_FOLDER: FolderResource = {
},
} as const satisfies FolderResource;
const PARENT_FOLDER: FolderResource = {
id: '2',
name: 'Folder 2',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
resourceType: 'folder',
readOnly: false,
workflowCount: 0,
subFolderCount: 0,
homeProject: {
id: '1',
name: 'Project 1',
icon: null,
type: 'team',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
} as const satisfies FolderResource;
const DEFAULT_BREADCRUMBS: { visibleItems: FolderPathItem[]; hiddenItems: FolderPathItem[] } = {
visibleItems: [{ id: '1', label: 'Parent 2' }],
hiddenItems: [{ id: '2', label: 'Parent 1', parentFolder: '1' }],
@@ -122,67 +103,6 @@ describe('FolderCard', () => {
expect(queryByTestId('folder-card-folder-count')).not.toBeInTheDocument();
});
it('should render breadcrumbs with personal folder', () => {
const { getByTestId } = renderComponent();
expect(getByTestId('folder-card-icon')).toBeInTheDocument();
expect(getByTestId('folder-card-breadcrumbs')).toHaveTextContent('Personal');
});
it('should render breadcrumbs with team project', () => {
const { getByTestId } = renderComponent({
props: {
data: {
...DEFAULT_FOLDER,
homeProject: {
id: '1',
name: 'Project 1',
icon: null,
type: 'team',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
},
},
});
expect(getByTestId('folder-card-icon')).toBeInTheDocument();
if (!DEFAULT_FOLDER.homeProject?.name) {
throw new Error('homeProject should be defined for this test');
}
expect(getByTestId('folder-card-breadcrumbs')).toHaveTextContent(
DEFAULT_FOLDER.homeProject.name,
);
});
it('should render breadcrumbs with home project and parent folder', () => {
const { getByTestId } = renderComponent({
props: {
data: {
...DEFAULT_FOLDER,
homeProject: {
id: '1',
name: 'Project 1',
icon: null,
type: 'team',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
parentFolder: PARENT_FOLDER,
},
breadcrumbs: {
visibleItems: [{ id: PARENT_FOLDER.id, label: PARENT_FOLDER.name, parentFolder: '1' }],
hiddenItems: [],
},
},
});
expect(getByTestId('folder-card-icon')).toBeInTheDocument();
if (!DEFAULT_FOLDER.homeProject?.name) {
throw new Error('homeProject should be defined for this test');
}
expect(getByTestId('folder-card-breadcrumbs')).toHaveTextContent(
`${DEFAULT_FOLDER.homeProject.name}/.../${PARENT_FOLDER.name}`,
);
});
it('should not render action dropdown if no actions are provided', () => {
const { queryByTestId } = renderComponent({
props: {