fix(ui): ensure publishSpecificLocale works during create operation (#13129)

### What?
This PR ensures that when a document is created using the `Publish in
__` button, it is saved to the correct locale.

### Why?
During document creation, the buttons `Publish` or `Publish in [locale]`
have the same effect. As a result, we overlooked the case where a user
may specifically click `Publish in [locale]` for the first save. In this
scenario, the create operation does not respect the
`publishSpecificLocale` value, so the document was always saved in the
default locale regardless of the intended one.

### How?
Passes the `publishSpecificLocale` value to the create operation,
ensuring the document and version is saved to the correct locale.

**Fixes:** #13117
This commit is contained in:
Jessica Rynkar
2025-07-21 14:19:51 +01:00
committed by GitHub
parent 7f9de6d101
commit dce898d7ca
5 changed files with 31 additions and 2 deletions

View File

@@ -618,6 +618,21 @@ describe('Localization', () => {
await expect(searchInput).toBeVisible()
await expect(searchInput).toHaveAttribute('placeholder', 'Search by Full title')
})
describe('publish specific locale', () => {
test('should create post in correct locale with publishSpecificLocale', async () => {
await page.goto(urlPostsWithDrafts.create)
await changeLocale(page, 'es')
await fillValues({ title: 'Created In Spanish' })
const chevronButton = page.locator('.form-submit .popup__trigger-wrap > .popup-button')
await chevronButton.click()
await saveDocAndAssert(page, '#publish-locale')
await expect(page.locator('#field-title')).toHaveValue('Created In Spanish')
await changeLocale(page, defaultLocale)
await expect(page.locator('#field-title')).toBeEmpty()
})
})
})
async function fillValues(data: Partial<LocalizedPost>) {