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
@@ -86,7 +86,14 @@
|
||||
Classes.connecting="{Binding IsConnecting}"
|
||||
Classes.dropped="{Binding IsDropped}"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding Label}" VerticalAlignment="Center" />
|
||||
<!--
|
||||
Bounded. A label is whatever the host was called, or the address typed into the palette,
|
||||
and one long one used to push every tab after it and the "+" past the strip's edge. The
|
||||
whole of it is on the label's own tooltip; the tab's is the address, as before.
|
||||
-->
|
||||
<TextBlock Text="{Binding Label}" VerticalAlignment="Center"
|
||||
MaxWidth="200" TextTrimming="CharacterEllipsis"
|
||||
ToolTip.Tip="{Binding Label}" />
|
||||
|
||||
<Button Classes="flat close inline" Width="16" Height="16" Padding="0"
|
||||
VerticalAlignment="Center"
|
||||
|
||||
@@ -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