Skip to content

Commit

Permalink
fix(kit): InputDateTime should format textfield value on blur (#7659)
Browse files Browse the repository at this point in the history
Co-authored-by: alen.a.popova <[email protected]>
  • Loading branch information
alyonagerasimova and alen.a.popova authored Jun 7, 2024
1 parent 22ee141 commit 505fe3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ describe('InputDateTime', () => {
'15.11.2018, '.length,
);
});

test('should time to pre-fill with zeros on blur', async ({page}) => {
await tuiGoto(page, '/components/input-date-time/API?timeMode=HH:MM:SS.MSS');

await inputDateTime.textfield.fill('07.06.2024, 23:59');
await inputDateTime.textfield.blur();

await expect(inputDateTime.textfield).toHaveValue('07.06.2024, 23:59:00.000');
});
});

describe('invalid date', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class TuiInputDateTimeComponent
if (
this.value[0] === null ||
this.value[1] !== null ||
this.nativeValue.length <= this.fillerLength + DATE_TIME_SEPARATOR.length ||
this.nativeValue.length === this.fillerLength ||
this.timeMode === 'HH:MM'
) {
return;
Expand Down

0 comments on commit 505fe3e

Please sign in to comment.