|
|
@@ -1213,6 +1213,35 @@ describe('home learning modules', () => {
|
|
|
expect(document.querySelector('.xs-dropdown-menu')).toBeNull();
|
|
|
});
|
|
|
|
|
|
+ it('shows the planned review day and original learning time for migrated August tasks', async () => {
|
|
|
+ user.set({ userId: 300, userName: 'coach', honeyName: '张老师', groupId: 3 });
|
|
|
+ session.groupId.set(3);
|
|
|
+ const api = TestBed.inject(ApiService) as unknown as LearningModulesApiService;
|
|
|
+ const post = api.post.bind(api);
|
|
|
+ spyOn(api, 'post').and.callFake((action, params) => action === 'app_review_page'
|
|
|
+ ? of({ retcode: 1, result: {
|
|
|
+ items: [{ GeneralID: 102, yhid: 100, xxjlid: 900, kcid: 801, Title: '张雅茜@任务',
|
|
|
+ kywrq: params?.['date'], kywsj: '2026-09-01 09:00', CreateTime: '2026-09-01T02:25:17Z',
|
|
|
+ learned_at: '2026-07-31T01:20:00Z', learned_date: '20260731', fxzt: 0 }],
|
|
|
+ page: { itemCount: 1, pageCount: 1 }, summary: { total: 1, completed: 0, due: 1, today: 0, income: 0 },
|
|
|
+ dates: [{ date: '2026-08-01', total: 1, completed: 0 }, { date: '2026-08-15', total: 1, completed: 0 }],
|
|
|
+ } } as ApiEnvelope<any>) : post(action, params));
|
|
|
+ const harness = await RouterTestingHarness.create();
|
|
|
+ await harness.navigateByUrl('/pages/stu/stu_calendar?date=2026-08-01');
|
|
|
+ await harness.fixture.whenStable();harness.fixture.detectChanges();
|
|
|
+ expect(harness.routeNativeElement?.querySelector('.task-context')?.textContent).toContain('复习日期 2026-08-01');
|
|
|
+ expect(harness.routeNativeElement?.querySelector('.first-learned-at')?.textContent).toContain('2026-07-31 09:20');
|
|
|
+ (harness.routeNativeElement?.querySelector('[aria-label^="2026-08-15"]') as HTMLButtonElement).click();
|
|
|
+ await harness.fixture.whenStable();harness.fixture.detectChanges();
|
|
|
+ expect(harness.routeNativeElement?.querySelector('.task-context')?.textContent).toContain('复习日期 2026-08-15');
|
|
|
+ const component = harness.fixture.debugElement.query(By.directive(LearningPageComponent)).componentInstance as LearningPageComponent;
|
|
|
+ const task = component.calendarItems()[0];
|
|
|
+ expect(component.calendarFirstLearnedAt({ learned_date: '20260731' })).toContain('2026-07-31(时间未记录)');
|
|
|
+ component.openCalendar(task);
|
|
|
+ await harness.fixture.whenStable();
|
|
|
+ expect(TestBed.inject(Router).url).toContain('plannedDate=2026-08-15');
|
|
|
+ });
|
|
|
+
|
|
|
it('keeps the anti-forget page visible while a selected date loads locally', async () => {
|
|
|
const harness = await RouterTestingHarness.create();
|
|
|
await harness.navigateByUrl('/pages/stu/stu_calendar');
|