Skip to content

Commit

Permalink
fix types and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DenysVuika committed Oct 10, 2023
1 parent cc84b75 commit aa8e809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/core/src/lib/common/utils/date-fns-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { DateFnsUtils } from './date-fns-utils';
import { Inject, Injectable, Optional } from '@angular/core';
import { MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatDateFormats } from '@angular/material/core';
import { UserPreferenceValues, UserPreferencesService } from '../services/user-preferences.service';
import { Locale } from 'date-fns';

/**
* Date-fns adapter with moment-to-date-fns conversion.
Expand Down Expand Up @@ -58,7 +59,7 @@ export class AdfDateFnsAdapter extends DateFnsAdapter {
}

constructor(
@Optional() @Inject(MAT_DATE_LOCALE) matDateLocale: any,
@Optional() @Inject(MAT_DATE_LOCALE) matDateLocale: Locale,
@Optional() @Inject(MAT_DATE_FORMATS) private formats: MatDateFormats,
preferences: UserPreferencesService
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,15 @@ describe('DateWidgetComponent', () => {
fixture.detectChanges();

let dateButton = element.querySelector<HTMLButtonElement>('button');
expect(dateButton?.disabled).toBeFalsy();
expect(dateButton).toBeDefined();
expect(dateButton.disabled).toBeFalsy();

widget.field.readOnly = true;
fixture.detectChanges();

dateButton = element.querySelector<HTMLButtonElement>('button');
expect(dateButton?.disabled).toBeTruthy();
expect(dateButton).toBeDefined();
expect(dateButton.disabled).toBeTruthy();
});

it('should set isValid to false when the value is not a correct date value', () => {
Expand Down

0 comments on commit aa8e809

Please sign in to comment.