feat(diff-viewer): folder/file-type icons and change-kind colours in the file tree
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
d8f78056c1
commit
ae778d5c30
@@ -0,0 +1,43 @@
|
||||
using ClaudeDo.Ui.ViewModels.Modals;
|
||||
|
||||
namespace ClaudeDo.Ui.Tests;
|
||||
|
||||
public class DiffFileIconsTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("src/Foo.cs", "mdi:LanguageCsharp")]
|
||||
[InlineData("Views/A.axaml", "mdi:CodeTags")]
|
||||
[InlineData("a.xaml", "mdi:CodeTags")]
|
||||
[InlineData("a.xml", "mdi:CodeTags")]
|
||||
[InlineData("package.json", "mdi:CodeJson")]
|
||||
[InlineData("README.md", "mdi:LanguageMarkdownOutline")]
|
||||
[InlineData("X.csproj", "mdi:FileCogOutline")]
|
||||
[InlineData("ClaudeDo.slnx", "mdi:FileCogOutline")]
|
||||
[InlineData("run.ps1", "mdi:Powershell")]
|
||||
[InlineData("build.sh", "mdi:Console")]
|
||||
[InlineData("logo.png", "mdi:FileImageOutline")]
|
||||
public void ForPath_MapsKnownExtensions(string path, string expected)
|
||||
=> Assert.Equal(expected, DiffFileIcons.ForPath(path));
|
||||
|
||||
[Theory]
|
||||
[InlineData("Foo.CS")]
|
||||
[InlineData("A.AXAML")]
|
||||
public void ForPath_IsCaseInsensitive(string path)
|
||||
=> Assert.NotEqual("mdi:FileOutline", DiffFileIcons.ForPath(path));
|
||||
|
||||
[Theory]
|
||||
[InlineData("Dockerfile")]
|
||||
[InlineData("notes.unknownext")]
|
||||
[InlineData("")]
|
||||
public void ForPath_FallsBackToGenericFile(string path)
|
||||
=> Assert.Equal("mdi:FileOutline", DiffFileIcons.ForPath(path));
|
||||
|
||||
[Fact]
|
||||
public void FolderIcon_FollowsIsExpanded()
|
||||
{
|
||||
var dir = new DiffTreeNodeViewModel { Name = "src", IsDirectory = true };
|
||||
Assert.Equal("mdi:FolderOpen", dir.IconKey);
|
||||
dir.IsExpanded = false;
|
||||
Assert.Equal("mdi:Folder", dir.IconKey);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user