Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions e2e/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,20 @@ test.describe('Task Manager App', () => {
await page.click('#goTodayBtn');
await expect(page.locator('#selectedDateDisplay')).toContainText('Today');
});

test('should reload active tab data when returning to today', async ({ page }) => {
// Switch to habits tab
await page.click('[data-tab="habits"]');
await expect(page.locator('#habits-tab')).toBeVisible();
// Navigate to previous day
await page.click('#prevDayBtn');
await expect(page.locator('#selectedDateDisplay')).not.toContainText('Today');
// Return to today via button
await page.click('#goTodayBtn');
// The habits tab should still be active and showing today's data
await expect(page.locator('#selectedDateDisplay')).toContainText('Today');
await expect(page.locator('#habits-tab')).toBeVisible();
});
});

// ========================
Expand Down
2 changes: 1 addition & 1 deletion js/app.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,12 @@ class TaskManager {
document.getElementById('goTodayBtn')!.addEventListener('click', () => {
this.selectedDate = new Date();
this.updateDateNavigator();
this.render();
const activeTabName = (document.querySelector('.nav-tab.active') as HTMLElement | null)?.dataset.tab;
if (activeTabName) {
this.switchTab(activeTabName);
} else {
this.renderDashboard();
}
});
}

Expand Down