fix(ui): connection pill opens worker help only when disconnected
The footer pill fired OpenWorkerConnectionHelpCommand unconditionally, so clicking it on a connected worker showed the "WORKER NOT REACHABLE" dialog. Gate the command on !IsConnected (not IsOffline — the retry loop stays in "connecting" forever while the worker is down, which is exactly when the dialog's "Start Worker" is needed) and re-evaluate CanExecute on connection state changes.
This commit is contained in:
@@ -19,4 +19,20 @@ public class ConnectionPromptGateTests
|
||||
var vm = new IslandsShellViewModel();
|
||||
Assert.False(vm.DecideShowConnectionPrompt(isOffline: false));
|
||||
}
|
||||
|
||||
// The footer pill binds OpenWorkerConnectionHelpCommand, and the dialog says "WORKER NOT
|
||||
// REACHABLE" — so it must stay closed while the worker is connected, and stay reachable
|
||||
// while it is not (including the endless "connecting" retry state).
|
||||
[Theory]
|
||||
[InlineData(true, false)]
|
||||
[InlineData(false, true)]
|
||||
public void Connection_help_is_gated_on_connected(bool isConnected, bool canOpen)
|
||||
=> Assert.Equal(canOpen, IslandsShellViewModel.DecideCanOpenConnectionHelp(isConnected));
|
||||
|
||||
[Fact]
|
||||
public void Connection_help_command_enabled_without_worker()
|
||||
{
|
||||
var vm = new IslandsShellViewModel();
|
||||
Assert.True(vm.OpenWorkerConnectionHelpCommand.CanExecute(null));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user