diff --git a/projects/kit/components/input-date/test/input-date.component.spec.ts b/projects/kit/components/input-date/test/input-date.component.spec.ts index bd88d6e63621..6e43e17db7ac 100644 --- a/projects/kit/components/input-date/test/input-date.component.spec.ts +++ b/projects/kit/components/input-date/test/input-date.component.spec.ts @@ -47,7 +47,7 @@ describe('InputDate', () => { readOnly = false; - min = new TuiDay(1900, 0, 1); + min: TuiDay | null = new TuiDay(1500, 0, 1); labelOutside = false; @@ -125,6 +125,15 @@ describe('InputDate', () => { expect(inputPO.value).toBe('14.03.2017'); }); + it('correct shows value less than 01.01.1900', async () => { + testComponent.control.patchValue(new TuiDay(1000, 0, 1)); + fixture.detectChanges(); + + await fixture.whenStable(); + + expect(inputPO.value).toBe('01.01.1000'); + }); + describe('Keyboard input', () => { it('The passed date is inserted into the field', () => { inputPO.sendText('01.03.2017'); @@ -211,10 +220,10 @@ describe('InputDate', () => { const typedDay = testComponent.control.value; - expect(inputPO.value).toBe('1900.01.01'); - expect(typedDay.day).toBe(1); - expect(typedDay.month).toBe(0); - expect(typedDay.year).toBe(1900); + expect(inputPO.value).toBe('1223.08.21'); + expect(typedDay.day).toBe(21); + expect(typedDay.month).toBe(7); + expect(typedDay.year).toBe(1223); }); it('sets valid day if date selected via calendar', async () => { @@ -258,10 +267,10 @@ describe('InputDate', () => { const typedDay = testComponent.control.value; - expect(inputPO.value).toBe('01.01.1900'); - expect(typedDay.day).toBe(1); - expect(typedDay.month).toBe(0); - expect(typedDay.year).toBe(1900); + expect(inputPO.value).toBe('08.21.1223'); + expect(typedDay.day).toBe(21); + expect(typedDay.month).toBe(7); + expect(typedDay.year).toBe(1223); }); it('sets valid day if date selected via calendar', async () => { @@ -363,8 +372,8 @@ describe('InputDate', () => { it('transforms min day as output (if typed day is less than min day)', () => { inputPO.sendText('19.02.1861'); - expect(inputPO.value).toBe('01.01.1900'); - expect(testComponent.control.value).toEqual(new Date(1900, 0, 1)); + expect(inputPO.value).toBe('19.02.1861'); + expect(testComponent.control.value).toEqual(new Date(1861, 1, 19)); }); it('transforms value which was selected via calendar', async () => {