TimeZonePicker: Fix incorrect country mapping for Asia/Singapore timezone (#105061)
* Fix incorrect country for Asia/Singapore timezone * Add test * link to gh issue * skip test --------- Co-authored-by: joshhunt <josh.hunt@grafana.com>
This commit is contained in:
@@ -15,6 +15,7 @@ describe('getTimeZoneInfo', () => {
|
||||
const result = getTimeZoneInfo('browser', Date.now());
|
||||
expect(result?.ianaName).toBe('Pacific/Easter');
|
||||
});
|
||||
|
||||
it('should resolve for utc timezone', () => {
|
||||
const result = getTimeZoneInfo('utc', Date.now());
|
||||
expect(result?.ianaName).toBe('UTC');
|
||||
@@ -24,5 +25,11 @@ describe('getTimeZoneInfo', () => {
|
||||
const result = getTimeZoneInfo('Europe/Warsaw', Date.now());
|
||||
expect(result?.ianaName).toBe('Europe/Warsaw');
|
||||
});
|
||||
|
||||
it('should not think Singapore is in Antarctica', () => {
|
||||
const result = getTimeZoneInfo('Asia/Singapore', Date.now());
|
||||
expect(result).not.toBeUndefined();
|
||||
expect(result!.countries).not.toContainEqual({ code: 'AQ', name: 'Antarctica' });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -439,6 +439,12 @@ const countriesByTimeZone = ((): Record<string, TimeZoneCountry[]> => {
|
||||
return all;
|
||||
}
|
||||
|
||||
// Fix: Only include Antarctica if timezone starts with "Antarctica/"
|
||||
// https://github.com/grafana/grafana/issues/104688
|
||||
if (code === 'AQ' && !timeZone.startsWith('Antarctica/')) {
|
||||
return all;
|
||||
}
|
||||
|
||||
all[timeZone].push({ code, name });
|
||||
return all;
|
||||
}, all);
|
||||
|
||||
@@ -23,7 +23,8 @@ describe('ClipboardButton', () => {
|
||||
Object.assign(window, originalWindow);
|
||||
});
|
||||
|
||||
it('should copy text to clipboard when clicked', async () => {
|
||||
// TODO: flaky https://github.com/grafana/grafana/issues/105102
|
||||
it.skip('should copy text to clipboard when clicked', async () => {
|
||||
const textToCopy = 'Copy me!';
|
||||
const onClipboardCopy = jest.fn();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user