fix(ui): refine amount entry, date warnings and booking actions

This commit is contained in:
2026-11-02 20:31:09 +01:00
parent 71eed68e21
commit aa392815e5
17 changed files with 140 additions and 39 deletions
@@ -0,0 +1,26 @@
using Bunit;
using Duempelkas.App.Components;
using Xunit;
namespace Duempelkas.Tests;
public class BookingDateInputTests
{
[Fact]
public void DateIsValidatedOnLeavingField_WithoutInterruptingNativeCalendar()
{
using var context = new BunitContext();
var value = "2025-12-31";
var field = context.Render<BookingDateInput>(p => p
.Add(x => x.Value, value).Add(x => x.ValueChanged, next => value = next));
field.Find("input").Input("2026-01-01");
Assert.Equal("2025-12-31", value);
field.Find("input").Blur();
Assert.Equal("2026-01-01", value);
field.Render(p => p.Add(x => x.Value, value));
// The browser owns the edited value; avoid resetting its calendar by writing it back.
Assert.Equal("2025-12-31", field.Find("input").GetAttribute("value"));
field.Render(p => p.Add(x => x.Value, "2027-02-03"));
Assert.Equal("2027-02-03", field.Find("input").GetAttribute("value"));
}
}