Allow users to set where new fields must be created in a record page layout (#18420)
## Demo https://github.com/user-attachments/assets/eaf89d0c-96e0-4e49-ac58-290c8e7403ff
This commit is contained in:
committed by
GitHub
parent
d37ed7e07c
commit
a79b816117
+30
@@ -0,0 +1,30 @@
|
||||
import { DateFormat } from '@/localization/constants/DateFormat';
|
||||
import { resolveDateFormat } from '@/localization/utils/resolveDateFormat';
|
||||
|
||||
jest.mock('@/localization/utils/detection/detectDateFormat', () => ({
|
||||
detectDateFormat: jest.fn(() => 'DAY_FIRST'),
|
||||
}));
|
||||
|
||||
describe('resolveDateFormat', () => {
|
||||
it('should detect system format when SYSTEM is passed', () => {
|
||||
const result = resolveDateFormat(DateFormat.SYSTEM);
|
||||
|
||||
expect(result).toBe(DateFormat.DAY_FIRST);
|
||||
});
|
||||
|
||||
it('should return MONTH_FIRST as-is', () => {
|
||||
expect(resolveDateFormat(DateFormat.MONTH_FIRST)).toBe(
|
||||
DateFormat.MONTH_FIRST,
|
||||
);
|
||||
});
|
||||
|
||||
it('should return DAY_FIRST as-is', () => {
|
||||
expect(resolveDateFormat(DateFormat.DAY_FIRST)).toBe(DateFormat.DAY_FIRST);
|
||||
});
|
||||
|
||||
it('should return YEAR_FIRST as-is', () => {
|
||||
expect(resolveDateFormat(DateFormat.YEAR_FIRST)).toBe(
|
||||
DateFormat.YEAR_FIRST,
|
||||
);
|
||||
});
|
||||
});
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
import { TimeFormat } from '@/localization/constants/TimeFormat';
|
||||
import { resolveTimeFormat } from '@/localization/utils/resolveTimeFormat';
|
||||
|
||||
jest.mock('@/localization/utils/detection/detectTimeFormat', () => ({
|
||||
detectTimeFormat: jest.fn(() => 'HOUR_24'),
|
||||
}));
|
||||
|
||||
describe('resolveTimeFormat', () => {
|
||||
it('should detect system format when SYSTEM is passed', () => {
|
||||
const result = resolveTimeFormat(TimeFormat.SYSTEM);
|
||||
|
||||
expect(result).toBe(TimeFormat.HOUR_24);
|
||||
});
|
||||
|
||||
it('should return HOUR_24 as-is', () => {
|
||||
expect(resolveTimeFormat(TimeFormat.HOUR_24)).toBe(TimeFormat.HOUR_24);
|
||||
});
|
||||
|
||||
it('should return HOUR_12 as-is', () => {
|
||||
expect(resolveTimeFormat(TimeFormat.HOUR_12)).toBe(TimeFormat.HOUR_12);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user