fix(classifier): file-only folders are expandable in Classify mode
A folder with files but no subfolders got no expand toggle, so in Classify & Copy mode its files (the drag source) could never be revealed — and leaf folders full of files are exactly where the work is. Make a folder expandable when it has files in classify mode; expanding lists the draggable file rows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1d09abdc8b
commit
eb07e7622d
2 changed files with 19 additions and 1 deletions
|
|
@ -153,7 +153,10 @@
|
||||||
toggle.className = 'folder-toggle';
|
toggle.className = 'folder-toggle';
|
||||||
const mightHaveChildren = (folder.children && folder.children.length > 0)
|
const mightHaveChildren = (folder.children && folder.children.length > 0)
|
||||||
|| folder.scanState === 'pending'
|
|| folder.scanState === 'pending'
|
||||||
|| folder.scanState === 'zip-pending';
|
|| folder.scanState === 'zip-pending'
|
||||||
|
// Classify mode: a folder with files (even none of subfolders) is
|
||||||
|
// expandable so its files can be revealed and dragged.
|
||||||
|
|| (classifyOn() && folder.files && folder.files.length > 0);
|
||||||
if (mightHaveChildren) {
|
if (mightHaveChildren) {
|
||||||
toggle.textContent = folder.expanded ? '▼' : '▶';
|
toggle.textContent = folder.expanded ? '▼' : '▶';
|
||||||
toggle.addEventListener('click', (e) => {
|
toggle.addEventListener('click', (e) => {
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,21 @@ test('source file rows render with a state dot in classify mode', async ({ page
|
||||||
await expect(page.locator('#folderTree .file-item .cl-dot--none')).toBeVisible();
|
await expect(page.locator('#folderTree .file-item .cl-dot--none')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('classify: a folder with files but no subfolders is expandable (drag source)', async ({ page }) => {
|
||||||
|
await page.click('#modeClassifyBtn');
|
||||||
|
await page.evaluate(() => {
|
||||||
|
window.app.folderTree = [{
|
||||||
|
name: 'Leaf', path: 'Leaf', expanded: false, scanState: 'done',
|
||||||
|
files: [{ originalFilename: 'x', extension: 'pdf', folderPath: 'Leaf' }], children: [],
|
||||||
|
}];
|
||||||
|
window.app.modules.tree.render();
|
||||||
|
});
|
||||||
|
const toggle = page.locator('#folderTree .folder-item .folder-toggle').first();
|
||||||
|
await expect(toggle).toHaveText('▶'); // file-only folder still gets an expand arrow
|
||||||
|
await toggle.click();
|
||||||
|
await expect(page.locator('#folderTree .file-item .file-name', { hasText: 'x.pdf' })).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
test('placing a file turns its dot (and the folder aggregate) done', async ({ page }) => {
|
test('placing a file turns its dot (and the folder aggregate) done', async ({ page }) => {
|
||||||
await withSourceTree(page);
|
await withSourceTree(page);
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue