fix(central-ui): Flow Debugger picker — site change clears the pick (test); wider column, shorter placeholder
Pins the site-change behaviour the picker's reference contract exists for: after picking an instance, switching the site select empties both the page's _selectedInstanceId and the picker's field text (the new site hands it a different instance list), and leaves the script select on its placeholder. Layout: the Instance column goes col-md-2 → col-md-3 so a full instance name fits — the script-entry branch still sums to 8 of 12 (site 2 + instance 3 + script 3), and Method never renders beside them — with the placeholder shortened to "Search instances…" for the narrower field. Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
@@ -815,4 +815,31 @@ public class FlowDebuggerPageTests : BunitContext
|
||||
cut.WaitForAssertion(() =>
|
||||
Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ScriptEntry_SiteChange_ClearsThePickedInstance()
|
||||
{
|
||||
RegisterServices();
|
||||
WireInstance();
|
||||
// A second site the operator can switch to, with no instances of its own.
|
||||
_sites.GetAllSitesAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult<IReadOnlyList<Site>>(
|
||||
[new Site("Plant A", "site-a") { Id = 1 }, new Site("Plant B", "site-b") { Id = 2 }]));
|
||||
_templates.GetInstancesBySiteIdAsync(2, Arg.Any<CancellationToken>())
|
||||
.Returns(Task.FromResult<IReadOnlyList<Instance>>([]));
|
||||
_templates.GetAreasBySiteIdAsync(2, Arg.Any<CancellationToken>())
|
||||
.Returns(Task.FromResult<IReadOnlyList<Area>>([]));
|
||||
|
||||
var cut = Render<FlowDebuggerPage>();
|
||||
cut.Find("button[data-test='flow-entry-script']").Click();
|
||||
cut.Find("select[data-test='flow-site-select']").Change("1");
|
||||
PickInstance(cut, 7);
|
||||
Assert.Equal("Sim01", cut.Find("[data-test='flow-instance-input']").GetAttribute("value"));
|
||||
|
||||
cut.Find("select[data-test='flow-site-select']").Change("2");
|
||||
|
||||
// The pick is dropped on both sides: the page's id and the picker's field text, which
|
||||
// it re-derives because the new site handed it a different instance list.
|
||||
Assert.Equal(string.Empty, cut.Find("[data-test='flow-instance-input']").GetAttribute("value"));
|
||||
Assert.Equal(["— choose —"], cut.FindAll("select[data-test='flow-script-select'] option").Select(o => o.TextContent.Trim()).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user