fix(tags): show no tooltip on a tag badge without a description
The badge bound its tooltip to the description directly, so a tag with an empty description popped up an empty tooltip.
This commit is contained in:
1 parent
7fd54fe84a
commit
a7b07db034
3 files changed
+14
-1
No files matched your search
@@ -456,6 +456,13 @@ public class BoardViewModelTests
|
||||
Assert.AreEqual(1, fixture.Repository.GetTags().Count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TagBadgeShowsNoTooltipForAnEmptyDescription()
|
||||
{
|
||||
Assert.IsNull(new TagBadgeViewModel(new TagModel(1, "bug", new RgbColor(1, 2, 3), "")).ToolTip);
|
||||
Assert.AreEqual("why", new TagBadgeViewModel(new TagModel(1, "bug", new RgbColor(1, 2, 3), "why")).ToolTip);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TagPickerHidesAssignedTagsAndFiltersCaseInsensitively()
|
||||
{
|
||||
|
||||
@@ -37,6 +37,12 @@ public sealed class TagBadgeViewModel : ViewModelBase
|
||||
/// </summary>
|
||||
public string Description => Tag.Description;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the badge tooltip: the description, or <see langword="null"/> (no
|
||||
/// tooltip at all) when the description is empty.
|
||||
/// </summary>
|
||||
public string? ToolTip => Tag.Description.Length > 0 ? Tag.Description : null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the badge fill: the tag's own color.
|
||||
/// </summary>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="board:TagBadgeViewModel">
|
||||
<Border Background="{Binding Background}" CornerRadius="10" Padding="8,2,4,2"
|
||||
Margin="0,0,6,6" ToolTip.Tip="{Binding Description}">
|
||||
Margin="0,0,6,6" ToolTip.Tip="{Binding ToolTip}">
|
||||
<StackPanel Orientation="Horizontal" Spacing="2">
|
||||
<TextBlock Text="{Binding Name}" Foreground="{Binding Foreground}"
|
||||
VerticalAlignment="Center" FontSize="12"/>
|
||||
|
||||
Reference in new issue
Block a user