Files
scadaproj/ZB.MOM.WW.Theme/tests/ZB.MOM.WW.Theme.Tests/NavStateScriptTests.cs
T
Joseph Doherty 48af177dce fix(theme): shell fills the dynamic viewport — drop calc(100vh - 3.3rem) (scadaproj#10)
.app-shell min-height is now 100vh with a 100dvh override (the 3.3rem was a
donor-app top-bar leftover; ThemeShell has no top bar) and the lg+ sticky
rail is 100vh/100dvh. Source bumped to 0.5.3, UNPUBLISHED. Adds a static
regression test and fixes the CS8602 in NavStateScriptTests (0 warnings).

Browser-checked via Overview on local 0.5.2 vs 0.5.3 packages: at 390x844 a
short page went from a 791px shell (53px gap) to 844px, no extra scroll;
1440x900 rail stays sticky full-height.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 22:36:20 -05:00

44 lines
1.4 KiB
C#

using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace ZB.MOM.WW.Theme.Tests;
/// <summary>
/// Theme-008: nav-state.js must not stack toggle listeners when Blazor's enhanced-navigation DOM
/// sync strips its marker attribute. Runs <c>nav-state.test.js</c> under Node (a DOM stub, no
/// jsdom); silently passes only when Node is not installed.
/// </summary>
public class NavStateScriptTests
{
private static string Here([CallerFilePath] string path = "") => Path.GetDirectoryName(path)!;
[Fact]
public void NavState_does_not_stack_listeners_or_persist_the_transient_reveal()
{
var script = Path.GetFullPath(Path.Combine(Here(), "..", "..", "src", "ZB.MOM.WW.Theme", "wwwroot", "js", "nav-state.js"));
var test = Path.Combine(Here(), "nav-state.test.js");
Process? node;
try
{
node = Process.Start(new ProcessStartInfo("node", $"\"{test}\" \"{script}\"")
{
RedirectStandardOutput = true,
RedirectStandardError = true,
});
}
catch (System.ComponentModel.Win32Exception)
{
return; // Node not available on this machine.
}
Assert.NotNull(node);
using (node)
{
var output = node.StandardOutput.ReadToEnd() + node.StandardError.ReadToEnd();
node.WaitForExit();
Assert.True(node.ExitCode == 0, output);
}
}
}