From 8ee0a81e6e9df2fe58d91aa6fb6b161343d27d3f Mon Sep 17 00:00:00 2001 From: Sander Schutten Date: Mon, 30 Oct 2023 17:34:46 +0100 Subject: [PATCH] Support DisabledDateFunc in FluentDatePicker (#905) --- .../DateTime/FluentDatePicker.razor | 3 + ....FluentCalendar_DisabledDate.verified.html | 82 +++++++++++++++++++ tests/Core/DateTime/FluentDatePickerTests.cs | 26 ++++++ 3 files changed, 111 insertions(+) create mode 100644 tests/Core/DateTime/FluentDatePickerTests.FluentCalendar_DisabledDate.verified.html diff --git a/src/Core/Components/DateTime/FluentDatePicker.razor b/src/Core/Components/DateTime/FluentDatePicker.razor index a7ff698e0c..8cff36d327 100644 --- a/src/Core/Components/DateTime/FluentDatePicker.razor +++ b/src/Core/Components/DateTime/FluentDatePicker.razor @@ -29,6 +29,9 @@ Class="fluent-datepicker-popup" Style="@($"z-index: {ZIndex.DatePickerPopup}; padding: 10px;")"> diff --git a/tests/Core/DateTime/FluentDatePickerTests.FluentCalendar_DisabledDate.verified.html b/tests/Core/DateTime/FluentDatePickerTests.FluentCalendar_DisabledDate.verified.html new file mode 100644 index 0000000000..fb508b63b0 --- /dev/null +++ b/tests/Core/DateTime/FluentDatePickerTests.FluentCalendar_DisabledDate.verified.html @@ -0,0 +1,82 @@ +
+
+ February 2022 + +
+ + + +
+
+ + + +
+
+
+
+
+
S
+
M
+
T
+
W
+
T
+
F
+
S
+
+
+
30
+
31
+
1
+
2
+
3
+
4
+
5
+
+
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
+
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
+
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
+
+
27
+
28
+
1
+
2
+
3
+
4
+
5
+
+
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
+
+
\ No newline at end of file diff --git a/tests/Core/DateTime/FluentDatePickerTests.cs b/tests/Core/DateTime/FluentDatePickerTests.cs index 984edafb2a..278a21ec4b 100644 --- a/tests/Core/DateTime/FluentDatePickerTests.cs +++ b/tests/Core/DateTime/FluentDatePickerTests.cs @@ -114,4 +114,30 @@ public void FluentDatePicker_WriteInvalidDateInTextField() // Assert Assert.Null(picker.Instance.Value); } + + [Fact] + public void FluentCalendar_DisabledDate() + { + // Arrange + using var ctx = new TestContext(); + + // Act + var picker = ctx.RenderComponent(parameters => + { + parameters.Add(p => p.Culture, CultureInfo.GetCultureInfo("en-US")); + parameters.Add(p => p.Value, new System.DateTime(2022, 02, 15)); + parameters.Add(p => p.DisabledDateFunc, (date) => date.Day == 14); + }); + + var textfield = picker.Find("fluent-text-field"); + + // Click + textfield.Click(); + + // Assert + var calendar = picker.FindComponent(); + + // Assert + calendar.Verify(); + } }