fix(claude-do): merge fix(ui): Usage-Pill bleibt nach App-Start leer — Initial-Loa
ClaudeDo-Task: cdb71ff5aefd4ae9819352a845e0be89
This commit is contained in:
@@ -22,6 +22,7 @@ public sealed partial class UsagePillViewModel : ViewModelBase
|
|||||||
{
|
{
|
||||||
_worker = worker;
|
_worker = worker;
|
||||||
_worker.UsageUpdatedEvent += OnUsageUpdated;
|
_worker.UsageUpdatedEvent += OnUsageUpdated;
|
||||||
|
_worker.ConnectionRestoredEvent += OnConnectionRestored;
|
||||||
_ = LoadAsync();
|
_ = LoadAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +35,8 @@ public sealed partial class UsagePillViewModel : ViewModelBase
|
|||||||
|
|
||||||
private void OnUsageUpdated(UsageSnapshotDto snapshot) => Snapshot = snapshot;
|
private void OnUsageUpdated(UsageSnapshotDto snapshot) => Snapshot = snapshot;
|
||||||
|
|
||||||
|
private void OnConnectionRestored() => _ = LoadAsync();
|
||||||
|
|
||||||
partial void OnSnapshotChanged(UsageSnapshotDto? value)
|
partial void OnSnapshotChanged(UsageSnapshotDto? value)
|
||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(Text));
|
OnPropertyChanged(nameof(Text));
|
||||||
|
|||||||
@@ -144,4 +144,20 @@ public class UsagePillViewModelTests
|
|||||||
|
|
||||||
Assert.Contains("12", vm.Text);
|
Assert.Contains("12", vm.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── ConnectionRestored event ─────────────────────────────────────────────
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ConnectionRestored_Event_LoadsSnapshot()
|
||||||
|
{
|
||||||
|
var worker = new FakeWorker();
|
||||||
|
var vm = new UsagePillViewModel(worker);
|
||||||
|
Assert.Null(vm.Snapshot);
|
||||||
|
|
||||||
|
worker.InitialSnapshot = Snapshot(fiveHourPercent: 25);
|
||||||
|
worker.RaiseConnectionRestored();
|
||||||
|
|
||||||
|
Assert.NotNull(vm.Snapshot);
|
||||||
|
Assert.Contains("25", vm.Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user