fix(claude-do): merge fix(ui): Settings-Politur — PowerUse-Zeitfenster validieren,

ClaudeDo-Task: f3f0a355-936c-4933-8236-d41c21fb73dc
This commit is contained in:
mika kuns
2026-09-10 13:34:29 +02:00
6 changed files with 50 additions and 3 deletions
@@ -30,4 +30,31 @@ public class GeneralSettingsTabViewModelTests
Assert.Equal(expectedValid, vm.Validate() is null);
}
[Theory]
[InlineData(null, true)]
[InlineData("", true)]
[InlineData("09:00", true)]
[InlineData("23:59", true)]
[InlineData("9:0", false)]
[InlineData("abc", false)]
[InlineData("25:00", false)]
public void Validate_PowerUseWindowStart_rejectsUnparseable(string? value, bool expectedValid)
{
var vm = new GeneralSettingsTabViewModel { PowerUseWindowStart = value };
Assert.Equal(expectedValid, vm.Validate() is null);
}
[Theory]
[InlineData(null, true)]
[InlineData("09:00", true)]
[InlineData("9:0", false)]
[InlineData("abc", false)]
public void Validate_PowerUseWindowEnd_rejectsUnparseable(string? value, bool expectedValid)
{
var vm = new GeneralSettingsTabViewModel { PowerUseWindowEnd = value };
Assert.Equal(expectedValid, vm.Validate() is null);
}
}
@@ -153,10 +153,17 @@ public class SettingsModalViewModelTests : IDisposable
Assert.Equal("18:00", vm.General.PowerUseWindowStart);
Assert.Equal(88, vm.General.PowerUseHandoffPct);
// A typo in the window is normalized to null on save, not stored as a fake window.
// A typo in the window blocks Save instead of silently becoming "round the clock".
vm.General.PowerUseWindowEnd = "not a time";
await vm.SaveCommand.ExecuteAsync(null);
Assert.Null(worker.Saved);
Assert.NotEqual("", vm.ValidationError);
// Clearing it back out is still a valid "round the clock" window and saves.
vm.General.PowerUseWindowEnd = "";
await vm.SaveCommand.ExecuteAsync(null);
Assert.True(worker.Saved!.PowerUseEnabled);
Assert.Equal("18:00", worker.Saved.PowerUseWindowStart);
Assert.Null(worker.Saved.PowerUseWindowEnd);