fix(plugin-nested-docs): publishing parent doc should not publish child doc (#9958)

## Bug Fix

### Issue
Draft children documents get overwritten when the parent document is
published.

### Fix
Correctly retrieve all documents, including drafts, during the resave
process. Add test to ensure parent documents can be published without
impacting the state of any children docs.
This commit is contained in:
Jessica Chowdhury
2024-12-13 17:04:07 +00:00
committed by GitHub
parent 796df37461
commit 50e7c24b17
2 changed files with 14 additions and 2 deletions

View File

@@ -136,5 +136,18 @@ describe('Nested Docs Plugin', () => {
// TODO: add back when error states are fixed
// await expect(parentSlugInChild).toHaveValue('/parent-slug-draft')
})
test('Publishing parent doc should not publish child', async () => {
await page.goto(url.edit(childId))
await page.locator(slugClass).nth(0).fill('child-updated-draft')
await page.locator(draftButtonClass).nth(0).click()
await page.goto(url.edit(parentId))
await page.locator(slugClass).nth(0).fill('parent-updated-published')
await page.locator(publishButtonClass).nth(0).click()
await page.goto(url.edit(childId))
await expect(page.locator(slugClass).nth(0)).toHaveValue('child-updated-draft')
})
})
})