fix(ui): drawers close on any click outside the rail — TEST was the missing third

Creator: 'when the test slide-out is active, then any click off the div should
close the div — this behaviour applies to all tabs, not just TEST.'

MainWindow.Window_PreviewMouseLeftButtonDown already closed the Stream Settings
and YPP drawers on any click outside TextPullOutHost, but its close list skipped
TestSession — so the TEST drawer never dismissed on an outside click.

Fix: run TestSession.CloseDrawerCommand in the same outside-click branch.
All three drawers share the rail host, so the containment check is unchanged.

Good Dog: ONE integration test — the existing TestStream window section now
raises a window-root PreviewMouseLeftButtonDown (source = window => outside the
rail; deterministic, no OS mouse) and asserts the TEST and Stream Settings
drawers both close. Gate: clean build 0 warnings, full vstest 318/318.
This commit is contained in:
2026-09-25 08:18:25 -07:00
parent 0981a72eea
commit ecb329e578
7 changed files with 91 additions and 32 deletions
+20
View File
@@ -6,6 +6,8 @@ using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Microsoft.Data.Sqlite;
using Xunit;
using ytLive.Models;
@@ -183,6 +185,24 @@ public sealed class TestStreamTests
Assert.True(model.TestSession.IsDrawerOpen);
model.TestSession.CloseDrawerCommand.Execute(null);
Assert.False(model.TestSession.IsDrawerOpen);
// Any left-click OUTSIDE the drawer rail collapses whichever drawer is
// open (MainWindow.Window_PreviewMouseLeftButtonDown) — the TEST drawer
// was the missing third; Stream Settings + YPP already behaved this way.
// A raised PreviewMouseLeftButtonDown on the window root lands "outside",
// deterministically, with no OS mouse input involved.
var outsideClick = new MouseButtonEventArgs(Mouse.PrimaryDevice, Environment.TickCount, MouseButton.Left)
{
RoutedEvent = UIElement.PreviewMouseLeftButtonDownEvent,
};
model.TestSession.ToggleDrawerCommand.Execute(null);
Assert.True(model.TestSession.IsDrawerOpen);
window.RaiseEvent(outsideClick);
Assert.False(model.TestSession.IsDrawerOpen, "TEST drawer must close on an outside click");
model.BroadcastForm.ToggleDrawerCommand.Execute(null);
Assert.True(model.BroadcastForm.IsDrawerOpen);
window.RaiseEvent(outsideClick);
Assert.False(model.BroadcastForm.IsDrawerOpen, "Stream Settings drawer must close on an outside click");
}
finally
{