Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ export function MoveDocToFolder({
collectionSlug={collectionSlug}
docData={initialData as FolderOrDocument['value']}
docID={id}
docTitle={title}
// In bulk edit there is no document, so `title` resolves to the `[Untitled]`
// placeholder. Passing `undefined` lets the button fall back to the
// collection's singular label instead of showing a fake document title.
docTitle={id ? title : undefined}
folderCollectionSlug={folderCollectionSlug}
folderFieldName={folderFieldName}
fromFolderID={fromFolderID as number | string}
Expand Down
25 changes: 25 additions & 0 deletions test/folders/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,31 @@ test.describe('Folders', () => {
)
})

test('should not title the folder drawer "[Untitled]" when bulk editing', async () => {
await page.goto(postURL.list)

await page.locator('tbody .row-1 input[type="checkbox"]').check()
await page.locator('.edit-many__toggle').click()

const bulkEditForm = page.locator('form.edit-many__form')
await expect(bulkEditForm).toBeVisible()

await selectInput({
multiSelect: true,
options: ['Folder'],
page,
selectLocator: bulkEditForm.locator('.react-select'),
})

await bulkEditForm.locator('.move-doc-to-folder').click()

// There is no document in bulk edit, so the heading must fall back to the
// collection's singular label rather than the `[Untitled]` placeholder.
const drawerHeading = page.locator('dialog .drawer-action-header__title')
await expect(drawerHeading).toBeVisible()
await expect(drawerHeading).toHaveText('Select folder for Post')
})

test('should resolve folder pills and not get stuck as Loading...', async () => {
await selectFolderAndConfirmMoveFromList({ folderName: 'Move Into This Folder', page })
const folderPill = page.locator('tbody .row-1 .move-doc-to-folder')
Expand Down