Public Access
Desktop: trim a long session tab label instead of letting it push the + off the strip
This commit is contained in:
1 parent
a6d3924e0d
commit
619f49a35a
2 files changed
+44
-1
No files matched your search
@@ -250,6 +250,42 @@ public sealed class SessionTabRowTests : IAsyncLifetime
|
||||
Token);
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// A label is whatever the host was called or the address typed into the palette, and nothing bounded it:
|
||||
/// one long one pushed the "+" past the edge of the strip, behind a scroll bar nobody looks for.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public async Task ALongLabelIsTrimmed_AndLeavesThePlusOnTheStrip()
|
||||
{
|
||||
await LayoutHarness.OnTheUiThreadAsync(
|
||||
() =>
|
||||
{
|
||||
var label = string.Concat(Enumerable.Repeat("a-very-long-host-name-", 12));
|
||||
|
||||
shell.Tabs.Add(new TerminalTabViewModel(1, label, "deploy@long.internal:22"));
|
||||
|
||||
var strip = new SessionTabRow { DataContext = shell, TabCommand = shell.SelectTabCommand };
|
||||
var window = LayoutHarness.HostAtMinimumSize(
|
||||
strip, LayoutHarness.MinimumWidth, LayoutHarness.MinimumHeight);
|
||||
|
||||
try
|
||||
{
|
||||
var text = strip.GetVisualDescendants().OfType<TextBlock>()
|
||||
.Single(block => string.Equals(block.Text, label, StringComparison.Ordinal));
|
||||
|
||||
text.Bounds.Width.ShouldBeLessThanOrEqualTo(200);
|
||||
ToolTip.GetTip(text).ShouldBe(label, "the whole of it is still one hover away");
|
||||
|
||||
LayoutHarness.Unreachable(window).ShouldBeEmpty();
|
||||
}
|
||||
finally
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
},
|
||||
Token);
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// v5b's tab, unlike the pill it replaced, paints no fill at all until it is either active or hovered —
|
||||
/// so "the plus differs from a tab" can no longer be proven against a resting, inactive one, which reads
|
||||
|
||||
Reference in new issue
Block a user