36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using System.IO;
|
|
|
|
namespace ZB.MOM.WW.Theme.Tests;
|
|
|
|
public class StaticAssetsTests
|
|
{
|
|
// wwwroot is copied next to the test assembly via the RCL static-web-asset pipeline,
|
|
// but the simplest stable check is against the source tree relative to the test binary.
|
|
private static string Wwwroot =>
|
|
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory,
|
|
"..", "..", "..", "..", "..", "src", "ZB.MOM.WW.Theme", "wwwroot"));
|
|
|
|
[Fact]
|
|
public void ThemeCss_exists_and_defines_accent_token()
|
|
{
|
|
var css = File.ReadAllText(Path.Combine(Wwwroot, "css", "theme.css"));
|
|
Assert.Contains("--accent:", css);
|
|
Assert.Contains("--ok:", css);
|
|
}
|
|
|
|
[Fact]
|
|
public void ThemeCss_uses_corrected_relative_font_path()
|
|
{
|
|
var css = File.ReadAllText(Path.Combine(Wwwroot, "css", "theme.css"));
|
|
Assert.Contains("url('../fonts/ibm-plex-sans-400.woff2')", css);
|
|
Assert.DoesNotContain("url('fonts/ibm-plex", css); // the latent 404 path is gone
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("ibm-plex-sans-400.woff2")]
|
|
[InlineData("ibm-plex-sans-600.woff2")]
|
|
[InlineData("ibm-plex-mono-500.woff2")]
|
|
public void Fonts_are_vendored(string file) =>
|
|
Assert.True(File.Exists(Path.Combine(Wwwroot, "fonts", file)));
|
|
}
|