feat(stats): show gross earned leave by rule (#67)
This commit is contained in:
1 parent
3fbf9c3172
commit
da08ee054d
10 files changed
+571
-9
No files matched your search
@@ -214,9 +214,36 @@ parentPort.on('message', (data) => globalThis.self.onmessage({ data }));
|
||||
]);
|
||||
if (outcome.kind === 'PlanningIncomplete')
|
||||
expect(outcome.reasons[0].code).toBe('user-cancelled');
|
||||
expect(plan.remainingBalances).toEqual([]);
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
const root: HTMLElement = fixture.nativeElement;
|
||||
root.querySelector<HTMLButtonElement>('.statistics-button')!.click();
|
||||
await fixture.whenStable();
|
||||
const dialog = document.querySelector('[role="dialog"]')!;
|
||||
const earnedStatistics = () => [
|
||||
dialog
|
||||
.querySelector('.statistics-summary > div:last-child dt')
|
||||
?.textContent?.replace(/\s+/g, ' ')
|
||||
.trim(),
|
||||
dialog
|
||||
.querySelector('.statistics-summary > div:last-child dd')
|
||||
?.textContent?.trim(),
|
||||
...Array.from(dialog.querySelectorAll('.earned-leave-breakdown dt'), (label) => [
|
||||
label.textContent?.trim(),
|
||||
label.nextElementSibling?.textContent?.trim(),
|
||||
]),
|
||||
];
|
||||
expect(earnedStatistics()).toEqual([
|
||||
'Congés acquis avant consommation (jours)',
|
||||
'1',
|
||||
['CP autour du férié', '1'],
|
||||
]);
|
||||
expect(dialog.textContent?.includes('Planning partiel')).toBe(cancelled);
|
||||
const originalDeclarations = structuredClone(calculation.snapshot.declaredDays);
|
||||
input.toggleDeclaredDay('2024-04-30', 'rtt');
|
||||
rules.updateRule({ ...rules.rules[0], name: 'Règle modifiée après calcul' });
|
||||
rules.deleteRule('producer');
|
||||
input.updateBalances(() => []);
|
||||
if (worker) {
|
||||
await vi.waitFor(() => expect(heldArtifactMessages.length).toBeGreaterThan(0));
|
||||
@@ -231,6 +258,13 @@ parentPort.on('message', (data) => globalThis.self.onmessage({ data }));
|
||||
const trace = await calculation.trace;
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
expect(earnedStatistics()).toEqual([
|
||||
'Congés acquis avant consommation (jours)',
|
||||
'1',
|
||||
['CP autour du férié', '1'],
|
||||
]);
|
||||
dialog.querySelector<HTMLButtonElement>('button')!.click();
|
||||
await vi.waitFor(() => expect(document.querySelector('[role="dialog"]')).toBeNull());
|
||||
expect(explanation).toMatchObject({
|
||||
kind: 'PlanExplanation',
|
||||
calculationDate: '2024-05-01',
|
||||
@@ -258,7 +292,6 @@ parentPort.on('message', (data) => globalThis.self.onmessage({ data }));
|
||||
expect(plan.placements).toEqual(direct.placements);
|
||||
expect(plan.ifThenContributions).toEqual(direct.ifThenContributions);
|
||||
expect(plan.metrics).toEqual(direct.metrics);
|
||||
const root: HTMLElement = fixture.nativeElement;
|
||||
expect(root.textContent).toContain('Droit futur généré');
|
||||
expect(root.textContent).toContain('CP autour du férié');
|
||||
expect(root.textContent).not.toContain('Règle modifiée après calcul');
|
||||
|
||||
@@ -134,6 +134,9 @@ export interface AppTranslations {
|
||||
averageWorkSequence: string;
|
||||
averageTimeOffPeriod: string;
|
||||
longestTimeOffPeriod: string;
|
||||
earnedLeave: string;
|
||||
earnedLeaveByRule: string;
|
||||
leaveDaysUnit: string;
|
||||
workingDays: string;
|
||||
calendarDays: string;
|
||||
partialPlan: string;
|
||||
|
||||
Reference in new issue
Block a user