fix(raw): a superseded manual-entry open can no longer feed the pickers another device's config
This commit is contained in:
+36
@@ -94,6 +94,42 @@ public sealed class RawManualTagEntryModalMergedConfigTests
|
||||
accessor().ShouldBe(merged);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task A_stale_open_never_feeds_the_picker_another_devices_config()
|
||||
{
|
||||
const string deviceA = """{"endpoint":"10.0.0.1:44818","slot":0}""";
|
||||
const string deviceB = """{"endpoint":"10.0.0.2:44818","slot":1}""";
|
||||
|
||||
var deviceAResolve = new TaskCompletionSource();
|
||||
var svc = new FakeRawTreeService
|
||||
{
|
||||
OnLoadMergedProbeConfigAsync = async deviceId =>
|
||||
{
|
||||
if (deviceId == "dev-A") { await deviceAResolve.Task; return ("AbCip", deviceA); }
|
||||
return ("AbCip", deviceB);
|
||||
},
|
||||
};
|
||||
|
||||
var modal = new RawManualTagEntryModal();
|
||||
InjectService(modal, svc);
|
||||
|
||||
// Quick close-reopen onto a different device while the first resolve is still in flight — the
|
||||
// grid shows dev-B, so dev-A's late continuation must not install its config underneath it.
|
||||
SetParameters(modal, visible: true, deviceId: "dev-A", driverType: "AbCip");
|
||||
var staleOpen = OpenAsync(modal);
|
||||
|
||||
SetParameters(modal, visible: false, deviceId: "dev-A", driverType: "AbCip");
|
||||
await OpenAsync(modal);
|
||||
|
||||
SetParameters(modal, visible: true, deviceId: "dev-B", driverType: "AbCip");
|
||||
await OpenAsync(modal);
|
||||
|
||||
deviceAResolve.SetResult();
|
||||
await staleOpen;
|
||||
|
||||
GetDriverConfigJson(modal).ShouldBe(deviceB);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the modal's <c>[Parameter]</c>s. By reflection because BL0005 forbids assigning component
|
||||
/// parameters from outside the component, and this project treats warnings as errors.
|
||||
|
||||
Reference in New Issue
Block a user