Skip to content

Conversation

dvoituron
Copy link
Collaborator

[dev-v5] POC to convert the Calendar and DatePicker to a generic type

DRAFT

… selected dates, improving type safety and flexibility.
Updated calendar components to support nullable DateTime values and generic date representations. Key changes include:
- Modified `DisabledDate` methods to accept `DateTime?`.
- Changed `SelectedDay` in `CalendarSelection.razor` to a non-nullable `DateTime`.
- Updated `DisabledDateFunc` in `FluentCalendarBase.cs` to use a generic type `TValue`.
- Refactored `OnSelectedDateHandlerAsync` to accept `TValue`.
- Implemented conversions to `TValue` in various methods for consistency.
- Enhanced `PickerMonthChanged` to handle nullable month values in `FluentDatePicker.razor`.
- Streamlined `OnSelectedDateAsync` to directly use `TValue`.

These changes improve the flexibility and robustness of the calendar components.
Copy link

Unit Tests

  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "Required", attributeValue: True, htmlAttribute: "required", htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "extra-attribute='My-Specific-Attribute'", html: "extra-attribute='My-Specific-Attribute'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Style='My-Specific-Style'", html: "style='My-Specific-Style'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_Default
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_ReturnsExpectedResults(input: "invalid-date", expectedSuccess: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.Utilities.FluentCalendarDayTests.IsToday_Property_IsCorrect
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Padding='10px'", html: "style='padding: 10px;*'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_TryParseValueFromString_DaysView(input: "", expectedResult: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Id='id='My-Specific-ID'", html: "id='My-Specific-ID'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_WithNonGregorianCalendars_UsesCorrectCulture(cultureName: "fa-IR")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.PickerMonthSelectAsync_TriggersPickerMonthChanged
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "Name", attributeValue: "my-name", htmlAttribute: "name", htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_Title_ByCulture(year: 2022, month: 2, day: 15, cultureName: "fa-IR")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "InputSlot", attributeValue: "input", htmlAttribute: null, htmlValue: "slot="input"", extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_SelectDate(initialDate: "2022-01-15", selectedDate: "2022-01-20", expectedDate: "2022-01-20", openedByKeyboard: False)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_TryParseValueFromString_YearsView(input: "", expectedResult: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "LabelWidth", attributeValue: "150px", htmlAttribute: null, htmlValue: "width: 150px;", extraCondition: "Set_LabelPosition_Before")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_ClickToOpenCalendar
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_WithNonGregorianCalendars_UsesCorrectCulture(cultureName: "ar-SA")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_AlwaysReturnsTrue
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_OneDayFormat
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "LabelPosition", attributeValue: Before, htmlAttribute: "label-position", htmlValue: "before", extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "ReadOnly", attributeValue: True, htmlAttribute: "readonly", htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Margin='10px'", html: "style='margin: 10px;*'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_Title
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Class='My-Specific-Item'", html: "class='My-Specific-Item'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "Message", attributeValue: "my-message", htmlAttribute: null, htmlValue: null, extraCondition: "Add_MessageCondition_AlwaysTrue")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_TryParseValueFromString_DaysView(input: null, expectedResult: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_SelectDate(initialDate: "2022-01-15", selectedDate: "2022-01-20", expectedDate: "2022-01-20", openedByKeyboard: True)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_AlwaysSetsValidationErrorMessageToNull
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Padding='my-padding'", html: "class='my-padding'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_TryParseValueFromString_YearsView(input: "invalid", expectedResult: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "AriaLabel", attributeValue: "my-aria-label", htmlAttribute: "aria-label", htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_Title_ByCulture(year: 2022, month: 2, day: 15, cultureName: "en-US")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_WeekDays_French
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "LostFocus", attributeValue: "input", htmlAttribute: null, htmlValue: null, extraCondition: "Check_LostFocus")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.Utilities.FluentCalendarDayTests.IsInactive_Property_IsCorrect(isOutsideMonth: False, isInDisabledList: False, expected: False)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "MessageState", attributeValue: Success, htmlAttribute: null, htmlValue: "color: var(--success);", extraCondition: "Add_MessageCondition_AlwaysTrue")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "Label", attributeValue: "my-label", htmlAttribute: null, htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_TryParseValueFromString_DaysView(input: "invalid date", expectedResult: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_TryParseValueFromString_YearsView(input: null, expectedResult: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_WeekDaysTitle
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_ReturnsExpectedResults(input: "", expectedSuccess: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.ComponentBaseTests.ComponentBase_DefaultProperties(blazor: "Margin='my-margin'", html: "class='my-margin'")
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "Disabled", attributeValue: True, htmlAttribute: "disabled", htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.TryParseValueFromString_ReturnsExpectedResults(input: null, expectedSuccess: True, expectedDateString: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.Base.InputBaseTests.InputBase_DefaultProperties(attributeName: "Autofocus", attributeValue: True, htmlAttribute: "autofocus", htmlValue: null, extraCondition: null)
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.PickerMonthSelectAsync_WithDifferentCultures_RespectsCalendar
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentCalendarTests.FluentCalendar_Default
  • ❌[FAILED] Microsoft.FluentUI.AspNetCore.Components.Tests.Components.DateTimes.FluentDatePickerTests.FluentDatePicker_SelectDate(initialDate: "2022-01-15 10:09:00", selectedDate: "2022-01-20", expectedDate: "2022-01-20 10:09:00", openedByKeyboard: False)

Details on your Workflow / Core Tests page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant