feat(dashboard): enhance appointment table and link to specific dates

This commit is contained in:
hamed
2026-07-18 21:54:08 +03:30
parent 62a9fd87c3
commit 4ce1b39a83
5 changed files with 81 additions and 73 deletions
+32
View File
@@ -98,6 +98,38 @@ describe('DashboardPage (ported clinic dashboard)', () => {
// ستون «وضعیت» از داشبورد حذف شده — تغییر وضعیت فقط در صفحه نوبت‌هاست
expect(screen.queryByText('وضعیت')).not.toBeInTheDocument();
expect(screen.queryByText('ویزیت شده')).not.toBeInTheDocument();
// کارت «پزشکان کلینیک» از داشبورد حذف شده
expect(screen.queryByText('پزشکان کلینیک')).not.toBeInTheDocument();
});
it('«مشاهده» به همان روزِ نوبت در لیست نوبت‌ها لینک می‌دهد', async () => {
renderWithProviders(<DashboardPage />, { route: '/admin/dashboard' });
await screen.findByText('دنیا خلیلی');
const d = new Date(1_718_000_000 * 1000);
const day = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
expect(screen.getByText('مشاهده').closest('a')).toHaveAttribute('href', `/admin/appointments?date=${day}`);
});
it('سلول‌های جدول با هدرهایشان هم‌تراز هستند (همه text-start جز ستون عملیات)', async () => {
const { container } = renderWithProviders(<DashboardPage />, { route: '/admin/dashboard' });
await screen.findByText('دنیا خلیلی');
const heads = Array.from(container.querySelectorAll('thead th'));
const cells = Array.from(container.querySelectorAll('tbody td'));
expect(heads).toHaveLength(cells.length);
heads.slice(0, -1).forEach(th => expect(th.className).toContain('text-start'));
cells.slice(0, -1).forEach(td => expect(td.className).toContain('text-start'));
// ستون آخر «عملیات» در هر دو سطر وسط‌چین است
expect(heads[heads.length - 1].className).toContain('text-center');
expect(cells[cells.length - 1].className).toContain('text-center');
// dir=ltr روی سلول نمی‌نشیند (جهت را برمی‌گرداند و هم‌ترازی را می‌شکند)
cells.forEach(td => expect(td.getAttribute('dir')).toBeNull());
});
it('calls the real clinic dashboard endpoint', async () => {