feat(dashboard): enhance appointment table and link to specific dates
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user