42 lines
1.7 KiB
C#
42 lines
1.7 KiB
C#
using Avalonia.Input;
|
|
using ClaudeDo.Ui.Views;
|
|
using Xunit;
|
|
|
|
namespace ClaudeDo.Ui.Tests.Views;
|
|
|
|
public class InteractiveTerminalDropPathsTests
|
|
{
|
|
[Fact]
|
|
public void Quotes_only_paths_with_spaces_and_ends_with_a_separator()
|
|
{
|
|
var text = InteractiveTerminalView.FormatDroppedPaths(
|
|
new[] { @"C:\repo\a.cs", @"C:\my repo\b.cs" });
|
|
|
|
Assert.Equal("C:\\repo\\a.cs \"C:\\my repo\\b.cs\" ", text);
|
|
}
|
|
|
|
[Fact]
|
|
public void Skips_items_without_a_local_path()
|
|
{
|
|
// IStorageItem.TryGetLocalPath() returns null for non-filesystem items (e.g. a virtual
|
|
// shell folder) — those must not turn into empty quotes in the composer.
|
|
Assert.Equal(@"C:\repo\a.cs ", InteractiveTerminalView.FormatDroppedPaths(new[] { null, @"C:\repo\a.cs", " " }));
|
|
Assert.Equal(string.Empty, InteractiveTerminalView.FormatDroppedPaths(new string?[] { null }));
|
|
Assert.Equal(string.Empty, InteractiveTerminalView.FormatDroppedPaths(null));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(KeyModifiers.Control | KeyModifiers.Alt, "@", true)]
|
|
[InlineData(KeyModifiers.Control | KeyModifiers.Alt, "\\", true)]
|
|
[InlineData(KeyModifiers.Control, "c", false)]
|
|
[InlineData(KeyModifiers.Alt, "@", false)]
|
|
[InlineData(KeyModifiers.None, "@", false)]
|
|
[InlineData(KeyModifiers.Control | KeyModifiers.Alt, "\u0003", false)]
|
|
[InlineData(KeyModifiers.Control | KeyModifiers.Alt, "", false)]
|
|
[InlineData(KeyModifiers.Control | KeyModifiers.Alt, null, false)]
|
|
public void IsAltGrText_only_for_ctrl_alt_with_one_printable_char(KeyModifiers modifiers, string? symbol, bool expected)
|
|
{
|
|
Assert.Equal(expected, InteractiveTerminalView.IsAltGrText(modifiers, symbol));
|
|
}
|
|
}
|