T hoguet/issue16 (#61)
* feat: enhance loading spinner with progress indication and add warning for unplaced vacation days * feat: upgrade Angular dependencies to version 21 and implement new animation features - Updated Angular dependencies in package.json to version 21.x.x. - Added `provideAnimationsAsync` to app configuration for improved animation handling. - Refactored user input component to utilize a dynamic list of vacation days with animations. - Introduced a new `DayInput` component for managing individual vacation days. - Enhanced styling and animations for user input and day input components. - Updated calendar service to support new vacation day structure. - Adjusted tests to accommodate changes in component structure and dependencies. * feat: enhance vacation optimization logic and UI components * Fix signal immutability violations and cleanup unused code (#62) * Initial plan * fix: address PR review comments for signal immutability and cleanup Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com> * fix: add --legacy-peer-deps for Angular 21 compatibility (#63) * Initial plan * fix: add --legacy-peer-deps to npm ci for Angular 21 compatibility Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com> * Fix unit tests for VacDay[] type migration (#64) * Initial plan * fix: update unit tests to match VacDay[] type structure Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: THoguet <61246905+THoguet@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
3272622abf
commit
d3515f89e5
16 files changed
+15752
-15364
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideZonelessChangeDetection } from '@angular/core';
|
||||
import { UserInputService } from './user-input-service';
|
||||
import { SelectableDayType, VacDay } from './calendar-service';
|
||||
|
||||
describe('UserInput', () => {
|
||||
describe('UserInputService', () => {
|
||||
let service: UserInputService;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -16,19 +17,41 @@ describe('UserInput', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should initialize with random vacation numbers', () => {
|
||||
it('should initialize with vacation days array', () => {
|
||||
const vacations = service.vacationNumberSignal();
|
||||
expect(vacations.cp).toBeGreaterThanOrEqual(1);
|
||||
expect(vacations.cp).toBeLessThanOrEqual(9);
|
||||
expect(vacations.rtt).toBeGreaterThanOrEqual(1);
|
||||
expect(vacations.rtt).toBeLessThanOrEqual(9);
|
||||
expect(vacations.other).toBeGreaterThanOrEqual(1);
|
||||
expect(vacations.other).toBeLessThanOrEqual(9);
|
||||
expect(Array.isArray(vacations)).toBe(true);
|
||||
expect(vacations.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should have vacation days with valid properties', () => {
|
||||
const vacations = service.vacationNumberSignal();
|
||||
vacations.forEach((day) => {
|
||||
expect(day.id).toBeDefined();
|
||||
expect(day.type).toBeDefined();
|
||||
expect(day.numberOfDays).toBeGreaterThanOrEqual(1);
|
||||
expect(day.numberOfDays).toBeLessThanOrEqual(9);
|
||||
expect(day.expiryDate).toBeInstanceOf(Date);
|
||||
});
|
||||
});
|
||||
|
||||
it('should update vacation number signal', () => {
|
||||
const newVacations = { cp: 5, rtt: 3, other: 2 };
|
||||
const newVacations: VacDay[] = [
|
||||
{
|
||||
id: 'test-id',
|
||||
type: SelectableDayType.CP,
|
||||
numberOfDays: 5,
|
||||
expiryDate: new Date(),
|
||||
},
|
||||
];
|
||||
service.vacationNumberSignal.set(newVacations);
|
||||
expect(service.vacationNumberSignal()).toEqual(newVacations);
|
||||
});
|
||||
|
||||
it('should create a new vacation day', () => {
|
||||
const newDay = service.createVacationDay();
|
||||
expect(newDay.id).toBeDefined();
|
||||
expect(newDay.type).toBe(SelectableDayType.CP);
|
||||
expect(newDay.numberOfDays).toBe(1);
|
||||
expect(newDay.expiryDate).toBeInstanceOf(Date);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user