Manual backport from popover

This commit is contained in:
Tig
2024-10-03 09:40:37 -06:00
parent a809356a9f
commit ac42da953f
13 changed files with 388 additions and 253 deletions

View File

@@ -103,7 +103,9 @@ public class KeyBindingTests
public void Defaults ()
{
var keyBindings = new KeyBindings ();
Assert.Throws<InvalidOperationException> (() => keyBindings.GetKeyFromCommands (Command.Accept));
Assert.Empty (keyBindings.Bindings);
Assert.Null (keyBindings.GetKeyFromCommands (Command.Accept));
Assert.Null (keyBindings.BoundView);
}
[Fact]
@@ -173,9 +175,6 @@ public class KeyBindingTests
key = keyBindings.GetKeyFromCommands (commands2);
Assert.Equal (Key.B, key);
// Negative case
Assert.Throws<InvalidOperationException> (() => key = keyBindings.GetKeyFromCommands (Command.RightEnd));
}
[Fact]
@@ -186,17 +185,14 @@ public class KeyBindingTests
Key key = keyBindings.GetKeyFromCommands (Command.Right);
Assert.Equal (Key.A, key);
// Negative case
Assert.Throws<InvalidOperationException> (() => key = keyBindings.GetKeyFromCommands (Command.Left));
}
// GetKeyFromCommands
[Fact]
public void GetKeyFromCommands_Unknown_Throws_InvalidOperationException ()
public void GetKeyFromCommands_Unknown_Returns_Key_Empty ()
{
var keyBindings = new KeyBindings ();
Assert.Throws<InvalidOperationException> (() => keyBindings.GetKeyFromCommands (Command.Accept));
Assert.Null (keyBindings.GetKeyFromCommands (Command.Accept));
}
[Fact]