* fix(dashboard): hide in-progress badge on compliance learner cards Keep the due date on My Learning and LMS current-course cards, and only show compliance status badges for states that need attention. Co-authored-by: best <best@classroomio.com> * fix(dashboard): enforce compliance deadline when publishing from view course site Reuse the settings deadline-required dialog and navigate to the completion deadline section so unpublished-site publish matches settings and the API. Co-authored-by: best <best@classroomio.com> * fix(dashboard): keep attention highlight visible after deadline navigation Prevent goto and dialog focus restoration from scrolling away from the completion deadline section before the highlight pulse can render. Co-authored-by: best <best@classroomio.com> * fix(dashboard): keep deadline attention highlight visible longer Use onMount plus afterNavigate so the completion deadline ring is not lost to navigation scroll races, and show a stronger primary ring for five seconds. Co-authored-by: best <best@classroomio.com> * test(dashboard): use Jest APIs in compliance badge tests Drop the Vitest import so the new test matches the dashboard's declared Jest runner and @types/jest globals. Co-authored-by: best <best@classroomio.com> ---------
29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import { shouldShowStudentCourseComplianceStatusBadge, getStudentCourseComplianceStatusKey } from './compliance-utils';
|
|
|
|
function makeCourse(overrides: { type?: string; complianceStatus?: string | null }) {
|
|
return {
|
|
type: overrides.type ?? 'COMPLIANCE',
|
|
complianceStatus: overrides.complianceStatus
|
|
} as Parameters<typeof shouldShowStudentCourseComplianceStatusBadge>[0];
|
|
}
|
|
|
|
describe('shouldShowStudentCourseComplianceStatusBadge', () => {
|
|
it('hides the in-progress badge on learner course cards', () => {
|
|
const course = makeCourse({ complianceStatus: 'in_progress' });
|
|
|
|
expect(shouldShowStudentCourseComplianceStatusBadge(course)).toBe(false);
|
|
expect(getStudentCourseComplianceStatusKey(course)).toBe('course.navItem.compliance.status.in_progress');
|
|
});
|
|
|
|
it('still shows overdue and expiring statuses', () => {
|
|
expect(shouldShowStudentCourseComplianceStatusBadge(makeCourse({ complianceStatus: 'non_compliant' }))).toBe(true);
|
|
expect(shouldShowStudentCourseComplianceStatusBadge(makeCourse({ complianceStatus: 'expiring_soon' }))).toBe(true);
|
|
});
|
|
|
|
it('is hidden for non-compliance courses', () => {
|
|
expect(
|
|
shouldShowStudentCourseComplianceStatusBadge(makeCourse({ type: 'SELF_PACED', complianceStatus: 'in_progress' }))
|
|
).toBe(false);
|
|
});
|
|
});
|