fix(dashboard): hide compliance in-progress badge and enforce deadline on view-site publish (#913)
* 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> ---------
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user