* chore: ensures relationship fields react to locale changes in the admin panel - fixes #1870 * chore: patches in default values for fields, and localized fields using fallbacks - fixes #1859 * chore: organizes field localization and sanitizing * Revert "Feat/1180 loading UI enhancements" * Feat/1180 loading UI enhancements * chore: safely sets tab if name field, only sets fallback value if it exists * chore: adds test to ensure text fields use fallback locale value when empty
This commit is contained in:
@@ -98,6 +98,28 @@ describe('Localization', () => {
|
||||
expect(localized.title.es).toEqual(spanishTitle);
|
||||
});
|
||||
|
||||
it('should fallback to english translation when empty', async () => {
|
||||
const updated = await payload.update<LocalizedPost>({
|
||||
collection,
|
||||
id: post1.id,
|
||||
locale: spanishLocale,
|
||||
data: {
|
||||
title: '',
|
||||
},
|
||||
});
|
||||
|
||||
expect(updated.title).toEqual(englishTitle);
|
||||
|
||||
const localizedFallback = await payload.findByID<LocalizedPostAllLocale>({
|
||||
collection,
|
||||
id: post1.id,
|
||||
locale: 'all',
|
||||
});
|
||||
|
||||
expect(localizedFallback.title.en).toEqual(englishTitle);
|
||||
expect(localizedFallback.title.es).toEqual('');
|
||||
});
|
||||
|
||||
describe('querying', () => {
|
||||
let localizedPost: LocalizedPost;
|
||||
beforeEach(async () => {
|
||||
|
||||
Reference in New Issue
Block a user