|
@@ -440,6 +440,28 @@ describe('home learning modules', () => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ it('shows only review states to students and keeps pay labels on teacher calendars', async () => {
|
|
|
|
|
+ const harness = await RouterTestingHarness.create('/pages/stu/stu_calendar?scope=overdue');
|
|
|
|
|
+ const calendar = harness.fixture.debugElement.query(By.directive(LearningPageComponent)).componentInstance as LearningPageComponent;
|
|
|
|
|
+ const today = new Date().toLocaleDateString('sv-SE', {timeZone:'Asia/Shanghai'});
|
|
|
|
|
+ calendar.calendarItems.set([
|
|
|
|
|
+ {GeneralID:1,kywsj:'2000-01-01',kywrq:'2000-01-01',fxzt:0},
|
|
|
|
|
+ {GeneralID:2,kywsj:today,kywrq:today,fxzt:0},
|
|
|
|
|
+ {GeneralID:3,kywsj:'2999-01-01',kywrq:'2999-01-01',fxzt:0},
|
|
|
|
|
+ {GeneralID:4,kywsj:'2000-01-01',kywrq:'2000-01-01',fxzt:1},
|
|
|
|
|
+ ]);
|
|
|
|
|
+ const states = () => Array.from(harness.routeNativeElement!.querySelectorAll('.task-state')).map(node => node.textContent!.trim());
|
|
|
|
|
+ harness.fixture.detectChanges();
|
|
|
|
|
+ expect(states()).toEqual(['逾期补做','待复习','未到期','已完成']);
|
|
|
|
|
+ expect(harness.routeNativeElement!.querySelector('.memory-date-tasks h2')?.textContent).toBe('逾期补做');
|
|
|
|
|
+ expect(harness.routeNativeElement!.textContent).not.toMatch(/计薪|记薪|工资|薪酬|收入/);
|
|
|
|
|
+ user.set({userId:300,groupId:3});session.groupId.set(3);harness.fixture.detectChanges();
|
|
|
|
|
+ expect(states()).toEqual(['逾期补做 · 不计薪','待复习 · 当天完成计薪','未到期','已完成']);
|
|
|
|
|
+ expect(harness.routeNativeElement!.querySelector('.memory-date-tasks h2')?.textContent).toBe('逾期补做 · 不计薪');
|
|
|
|
|
+ user.set({userId:100,groupId:1});session.groupId.set(1);harness.fixture.detectChanges();
|
|
|
|
|
+ expect(harness.routeNativeElement!.textContent).not.toMatch(/计薪|记薪|工资|薪酬|收入/);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
it('loads the review calendar once per login and refreshes only on an explicit request', async () => {
|
|
it('loads the review calendar once per login and refreshes only on an explicit request', async () => {
|
|
|
const api = TestBed.inject(ApiService) as unknown as LearningModulesApiService;
|
|
const api = TestBed.inject(ApiService) as unknown as LearningModulesApiService;
|
|
|
const originalPost = api.post.bind(api);
|
|
const originalPost = api.post.bind(api);
|