Public Access
Desktop: let the arrows choose the host the drawer acts on, and Enter connect to it
This commit is contained in:
1 parent
6c09bdecb6
commit
079914bfb4
2 files changed
+146
No files matched your search
@@ -465,6 +465,61 @@ public sealed class HostGridTests : IAsyncLifetime
|
||||
});
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// The arrows' half of the selection. The cards' <c>SelectedItem</c> is one-way, so a card the keyboard lit
|
||||
/// used to stay out of the vault — and the drawer's CONNECT and DELETE then acted on the card clicked
|
||||
/// before it, the mistake <see cref="ARightClickSelectsTheHostUnderThePointer"/> is about.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public async Task TheArrowsMoveTheVaultsSelection_AndEnterConnectsToIt()
|
||||
{
|
||||
await OnTheBoardAsync((screen, window) =>
|
||||
{
|
||||
var first = Row(vault, "prod-db");
|
||||
var other = Row(vault, "stage-web");
|
||||
|
||||
Click(CardFor(screen, first), window);
|
||||
vault.SelectedHost.ShouldBeSameAs(first);
|
||||
|
||||
window.KeyPressQwerty(PhysicalKey.ArrowRight, RawInputModifiers.None);
|
||||
Dispatcher.UIThread.RunJobs();
|
||||
|
||||
vault.SelectedHost.ShouldBeSameAs(other, "the card the arrow lit, not the one clicked before it");
|
||||
|
||||
vault.ConnectCommand.ExecutionTask.ShouldBeNull();
|
||||
|
||||
window.KeyPressQwerty(PhysicalKey.Enter, RawInputModifiers.None);
|
||||
Dispatcher.UIThread.RunJobs();
|
||||
|
||||
// The command, not a connection: these hosts were saved with nothing to sign in with, so it stops
|
||||
// at saying so — about the card Enter was pressed on, which is the selection checked above.
|
||||
vault.ConnectCommand.ExecutionTask.ShouldNotBeNull("Enter on a card is the double-press");
|
||||
});
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// The board is where this screen puts the keyboard, and none of the section lists inside it has it until
|
||||
/// a card has been clicked — so without this an arrow pressed on arriving went nowhere at all.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public async Task AnArrowOnTheBoardItselfGoesIntoTheCards()
|
||||
{
|
||||
await OnTheBoardAsync((screen, window) =>
|
||||
{
|
||||
vault.SelectedHost = null;
|
||||
|
||||
screen.Board.Focus();
|
||||
Dispatcher.UIThread.RunJobs();
|
||||
|
||||
window.KeyPressQwerty(PhysicalKey.ArrowDown, RawInputModifiers.None);
|
||||
Dispatcher.UIThread.RunJobs();
|
||||
|
||||
var focused = window.FocusManager!.GetFocusedElement().ShouldBeOfType<ListBoxItem>();
|
||||
|
||||
vault.SelectedHost.ShouldNotBeNull().ShouldBeSameAs(focused.DataContext);
|
||||
});
|
||||
}
|
||||
|
||||
// ---- Helpers ----
|
||||
|
||||
private static void RightClick(Visual card, Visual window)
|
||||
|
||||
Reference in new issue
Block a user