mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-03 10:27:58 +08:00
Fixed link not dispalyed in markup in Style.cs and added unit test cases (#1750)
This commit is contained in:
@ -226,6 +226,11 @@ public sealed class Style : IEquatable<Style>
|
|||||||
builder.Add("on " + Background.ToMarkup());
|
builder.Add("on " + Background.ToMarkup());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Link != null)
|
||||||
|
{
|
||||||
|
builder.Add($"link={Link}");
|
||||||
|
}
|
||||||
|
|
||||||
return string.Join(" ", builder);
|
return string.Join(" ", builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,5 +405,31 @@ public sealed class StyleTests
|
|||||||
// Then
|
// Then
|
||||||
result.ShouldBe("default on green");
|
result.ShouldBe("default on green");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Should_Return_Expected_Markup_For_Style_With_Only_Link()
|
||||||
|
{
|
||||||
|
// Given
|
||||||
|
var style = new Style(link:"https://spectreconsole.net/");
|
||||||
|
|
||||||
|
// When
|
||||||
|
var result = style.ToMarkup();
|
||||||
|
|
||||||
|
// Then
|
||||||
|
result.ShouldBe("link=https://spectreconsole.net/");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Should_Return_Expected_Markup_For_Style_With_Background_And_Link()
|
||||||
|
{
|
||||||
|
// Given
|
||||||
|
var style = new Style(background: Color.Blue, link: "https://spectreconsole.net/");
|
||||||
|
|
||||||
|
// When
|
||||||
|
var result = style.ToMarkup();
|
||||||
|
|
||||||
|
// Then
|
||||||
|
result.ShouldBe("default on blue link=https://spectreconsole.net/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user