Skip to content

Commit 64c0bc4

Browse files
committed
test: add unit tests for BrandLogoOptions to verify logo settings and defaults
1 parent adecc83 commit 64c0bc4

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using ShellDocs.Components;
2+
using Xunit;
3+
4+
namespace ShellDocs.Tests;
5+
6+
public class BrandLogoOptionsTests
7+
{
8+
[Fact]
9+
public void SetLogo_SingleUrl_AppliesToBothThemes()
10+
{
11+
var options = new ShellDocsOptions().SetLogo("/img/logo.svg");
12+
13+
Assert.Equal("/img/logo.svg", options.LogoLight);
14+
Assert.Equal("/img/logo.svg", options.LogoDark);
15+
}
16+
17+
[Fact]
18+
public void SetLogo_LightAndDark_KeepsBothDistinct()
19+
{
20+
var options = new ShellDocsOptions().SetLogo("/img/light.svg", "/img/dark.svg", "Brand");
21+
22+
Assert.Equal("/img/light.svg", options.LogoLight);
23+
Assert.Equal("/img/dark.svg", options.LogoDark);
24+
Assert.Equal("Brand", options.LogoAlt);
25+
}
26+
27+
[Fact]
28+
public void LogoHeight_DefaultsToOnePointThreeSevenFiveRem()
29+
{
30+
Assert.Equal(1.375, new ShellDocsOptions().LogoHeight);
31+
}
32+
33+
[Fact]
34+
public void Logos_DefaultToNull_SoDotFallbackRenders()
35+
{
36+
var options = new ShellDocsOptions();
37+
Assert.Null(options.LogoLight);
38+
Assert.Null(options.LogoDark);
39+
Assert.Null(options.LogoSvg);
40+
}
41+
42+
[Fact]
43+
public void LogoSvg_HoldsRawMarkupUntouched()
44+
{
45+
const string svg = "<svg viewBox=\"0 0 24 24\"><path d=\"M0 0h24v24H0z\" fill=\"currentColor\"/></svg>";
46+
var options = new ShellDocsOptions { LogoSvg = svg };
47+
48+
Assert.Equal(svg, options.LogoSvg);
49+
}
50+
}

0 commit comments

Comments
 (0)