|
|
@@ -1,5 +1,8 @@
|
|
|
-import { matchesScheduleSearch, scheduleCoachBusy, scheduleCoachesWithAppointments, scheduleCourseAvailable, schedulePreflightCandidates, scheduleRowActions } from './operations-schedule.component';
|
|
|
+import { TestBed } from '@angular/core/testing';
|
|
|
+import { ActivatedRoute, convertToParamMap } from '@angular/router';
|
|
|
+import { matchesScheduleSearch, OperationsScheduleComponent, scheduleCoachBusy, scheduleCoachesWithAppointments, scheduleCourseAvailable, schedulePreflightCandidates, scheduleRowActions } from './operations-schedule.component';
|
|
|
import { ScheduleAppointment, ScheduleCalendarData } from '../admin.models';
|
|
|
+import { OperationsService } from '../operations.service';
|
|
|
import { scheduleMatchesStatus, scheduleStatusLabel, scheduleStatusTone } from './operations-schedule-status';
|
|
|
|
|
|
describe('排课搜索匹配', () => {
|
|
|
@@ -142,3 +145,34 @@ describe('批量排课逐项预检', () => {
|
|
|
expect(results[1]).toEqual(jasmine.objectContaining({ index: 1, available: true, reasons: [] }));
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+describe('排课数据加载提示', () => {
|
|
|
+ it('读取排课数据期间显示明显提示,完成后自动收起', async () => {
|
|
|
+ let finish!: (value: ScheduleCalendarData) => void;
|
|
|
+ const response = new Promise<ScheduleCalendarData>(resolve => { finish = resolve; });
|
|
|
+ await TestBed.configureTestingModule({
|
|
|
+ imports: [OperationsScheduleComponent],
|
|
|
+ providers: [
|
|
|
+ { provide: OperationsService, useValue: { schedule: jasmine.createSpy().and.returnValue(response) } },
|
|
|
+ { provide: ActivatedRoute, useValue: { snapshot: { queryParamMap: convertToParamMap({}) } } },
|
|
|
+ ],
|
|
|
+ }).compileComponents();
|
|
|
+
|
|
|
+ const fixture = TestBed.createComponent(OperationsScheduleComponent);
|
|
|
+ fixture.detectChanges();
|
|
|
+ const loading = fixture.nativeElement.querySelector('[data-testid="schedule-loading"]') as HTMLElement;
|
|
|
+ expect(loading?.textContent).toContain('正在加载排课数据');
|
|
|
+ expect(fixture.nativeElement.querySelector('.content-card')?.getAttribute('aria-busy')).toBe('true');
|
|
|
+
|
|
|
+ finish({
|
|
|
+ appointments: [], members: [], courses: [], coaches: [], totalAppointments: 0,
|
|
|
+ unassigned: [], dateFrom: '2026-09-10', dateTo: '2026-09-10',
|
|
|
+ dataDateFrom: '', dataDateTo: '', refreshedAt: '', liveSourceAvailable: true,
|
|
|
+ liveSourceMessage: '', liveSourceCount: 0,
|
|
|
+ });
|
|
|
+ await fixture.whenStable();
|
|
|
+ fixture.detectChanges();
|
|
|
+ expect(fixture.nativeElement.querySelector('[data-testid="schedule-loading"]')).toBeNull();
|
|
|
+ expect(fixture.nativeElement.querySelector('.content-card')?.getAttribute('aria-busy')).toBe('false');
|
|
|
+ });
|
|
|
+});
|