mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-02 01:03:32 +01:00
Add support for markup text in panel header
This commit is contained in:
committed by
Patrik Svensson
parent
be3350a411
commit
b1da5e7ba8
@@ -316,14 +316,14 @@ namespace Spectre.Console.Tests.Unit
|
||||
var panel = new Panel(grid)
|
||||
.Expand().RoundedBorder()
|
||||
.BorderStyle(new Style().Foreground(Color.Grey))
|
||||
.Header("Short paths ", new Style().Foreground(Color.Grey));
|
||||
.Header("[grey]Short paths[/]");
|
||||
|
||||
// When
|
||||
console.Render(panel);
|
||||
|
||||
// Then
|
||||
console.Lines.Count.ShouldBe(4);
|
||||
console.Lines[0].ShouldBe("╭─Short paths ─────────────────────────────────────────────────────────────────────╮");
|
||||
console.Lines[0].ShouldBe("╭─Short paths──────────────────────────────────────────────────────────────────────╮");
|
||||
console.Lines[1].ShouldBe("│ at System.Runtime.CompilerServices.TaskAwaiter. │");
|
||||
console.Lines[2].ShouldBe("│ HandleNonSuccessAndDebuggerNotification(Task task) │");
|
||||
console.Lines[3].ShouldBe("╰──────────────────────────────────────────────────────────────────────────────────╯");
|
||||
|
||||
@@ -19,6 +19,34 @@ namespace Spectre.Console.Tests.Unit
|
||||
console.Lines[0].ShouldBe("────────────────────────────────────────");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Should_Render_Default_Rule_With_Specified_Box()
|
||||
{
|
||||
// Given
|
||||
var console = new PlainConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule().DoubleBorder());
|
||||
|
||||
// Then
|
||||
console.Lines.Count.ShouldBe(1);
|
||||
console.Lines[0].ShouldBe("════════════════════════════════════════");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Should_Render_With_Specified_Box()
|
||||
{
|
||||
// Given
|
||||
var console = new PlainConsole(width: 40);
|
||||
|
||||
// When
|
||||
console.Render(new Rule("Hello World").DoubleBorder());
|
||||
|
||||
// Then
|
||||
console.Lines.Count.ShouldBe(1);
|
||||
console.Lines[0].ShouldBe("═════════════ Hello World ══════════════");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Should_Render_Default_Rule_With_Title_Centered_By_Default()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user