fix(ui): hide planning details by default

This commit is contained in:
nessar committed 2026-08-31 00:23:09 +02:00
1 parent d7a13b0b1e
commit fb0c86da3f
4 files changed
+362 -316

No files matched your search

@@ -235,7 +235,7 @@ describe('CalendarYear planning outcome boundary', () => {
expect(summaryValues).toEqual(['2', '4', '6']);
});
it('keeps an incomplete incumbent visible with its interrupted-stage explanation', async () => {
it('keeps an incomplete incumbent visible and exposes its interrupted-stage details', async () => {
const outcome: PlanningIncompleteOutcome = {
kind: 'PlanningIncomplete',
incumbent: plan,
@@ -266,13 +266,17 @@ describe('CalendarYear planning outcome boundary', () => {
await new Promise<void>((resolve) => setTimeout(resolve, 0));
fixture.detectChanges();
const details = fixture.nativeElement.querySelector('.plan-details') as HTMLDetailsElement;
details.open = true;
details.dispatchEvent(new Event('toggle'));
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.incomplete-incumbent').textContent).toContain(
'holiday-week-value',
);
expect(fixture.nativeElement.querySelectorAll('button.selected')).toHaveLength(2);
});
it('shows the stable placement explanation by default and keeps the full plan visible', async () => {
it('keeps the simple result visible and reveals placement details on demand', async () => {
const { calendar, calculation } = calendarFor(plan, explanation);
await TestBed.configureTestingModule({
imports: [CalendarYear],
@@ -287,10 +291,18 @@ describe('CalendarYear planning outcome boundary', () => {
await new Promise<void>((resolve) => setTimeout(resolve, 0));
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('.placement-explanation')).not.toBeNull();
expect(fixture.nativeElement.textContent).toContain('Paid leave');
const details = fixture.nativeElement.querySelector('.plan-details') as HTMLDetailsElement;
expect(details.open).toBe(false);
expect(fixture.nativeElement.querySelectorAll('button.selected')).toHaveLength(2);
expect(fixture.nativeElement.querySelector('button.current')).toBeNull();
expect(fixture.nativeElement.querySelectorAll('.legend-symbol')).toHaveLength(0);
expect(calculation.analyzeCounterfactual).not.toHaveBeenCalled();
details.open = true;
details.dispatchEvent(new Event('toggle'));
fixture.detectChanges();
expect(calculation.analyzeCounterfactual).toHaveBeenCalledWith(plan.placements[0]);
expect(fixture.nativeElement.textContent).toContain('Paid leave');
const next = fixture.nativeElement.querySelector(
'button[data-step="next"]',
@@ -300,6 +312,11 @@ describe('CalendarYear planning outcome boundary', () => {
expect(fixture.nativeElement.querySelector('button.current')?.dataset.date).toBe(
'2024-05-06',
);
details.open = false;
details.dispatchEvent(new Event('toggle'));
fixture.detectChanges();
expect(fixture.nativeElement.querySelector('button.current')).toBeNull();
});
it('renders conflict causes and replays an atomic trace decision', async () => {