refactor: server-about-modal (#22138)

* refactor: server-about-modal

* fix: bits-ui scroll lock cleanup
This commit is contained in:
Jason Rasmussen 2025-09-17 12:23:23 -04:00 committed by GitHub
parent 53c67f4d71
commit 98ea3847e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 74 additions and 118 deletions

View file

@ -0,0 +1,24 @@
<script lang="ts">
import { Label, Link, Text } from '@immich/ui';
type Props = {
id: string;
title: string;
version?: string;
versionHref?: string;
class?: string;
};
const { id, title, version, versionHref, class: className }: Props = $props();
</script>
<div class={className}>
<Label size="small" color="primary" for={id}>{title}</Label>
<Text size="small" color="muted" {id}>
{#if versionHref}
<Link external href={versionHref}>{version}</Link>
{:else}
{version}
{/if}
</Text>
</div>

View file

@ -1,6 +1,6 @@
import { getIntersectionObserverMock } from '$lib/__mocks__/intersection-observer.mock';
import { getVisualViewportMock } from '$lib/__mocks__/visual-viewport.mock';
import { fireEvent, render, screen } from '@testing-library/svelte';
import { fireEvent, render, screen, waitFor } from '@testing-library/svelte';
import userEvent from '@testing-library/user-event';
import { DateTime } from 'luxon';
import ChangeDate from './change-date.svelte';
@ -30,6 +30,13 @@ describe('ChangeDate component', () => {
vi.resetAllMocks();
});
afterAll(async () => {
await waitFor(() => {
// check that bits-ui body scroll-lock class is gone
expect(document.body.style.pointerEvents).not.toBe('none');
});
});
test('should render correct values', () => {
render(ChangeDate, { initialDate, initialTimeZone, onCancel, onConfirm });
expect(getDateInput().value).toBe('2024-01-01T00:00');