Fixed typo and added test

Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
Andre Wanlin
2022-06-20 13:01:20 -05:00
parent a46e317a75
commit cec13be485
2 changed files with 30 additions and 1 deletions
@@ -86,3 +86,32 @@ describe('HeaderWorldClock with invalid Time Zone', () => {
expect(rendered.getByText('GMT')).toBeInTheDocument();
});
});
describe('HeaderWorldClock with custom Time Format', () => {
it('uses 24hr clock from custom Time Format', async () => {
const clockConfigs: ClockConfig[] = [
{
label: 'UTC',
timeZone: 'UTC',
},
];
const timeFormat: Intl.DateTimeFormatOptions = {
hour: '2-digit',
minute: '2-digit',
hour12: false,
};
const rendered = await renderInTestApp(
<ThemeProvider theme={lightTheme}>
<HeaderWorldClock
clockConfigs={clockConfigs}
customTimeFormat={timeFormat}
/>
</ThemeProvider>,
);
const currentTime = `${new Date().getHours()}:${new Date().getMinutes()}`;
expect(rendered.getByText(currentTime)).toBeInTheDocument();
});
});