import { describe, it, expect, afterEach } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import { page } from 'vitest/browser';
import DocumentDate from './DocumentDate.svelte';

// Browser-project (Playwright) tests — CI only.

afterEach(cleanup);

describe('DocumentDate', () => {
	it('renders a DAY date as a full long date', async () => {
		render(DocumentDate, { props: { iso: '1943-12-24', precision: 'DAY' } });
		await expect.element(page.getByText('24. Dezember 1943')).toBeInTheDocument();
	});

	it('renders MONTH precision as month + year, never a day', async () => {
		render(DocumentDate, { props: { iso: '1916-06-01', precision: 'MONTH', raw: 'Juni 1916' } });
		await expect.element(page.getByText('Juni 1916')).toBeInTheDocument();
	});
});
