mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 17:02:51 +08:00
Improve the unit test around HideCompleted
This commit is contained in:
parent
1c769c6610
commit
ef08c5bf2b
@ -189,7 +189,9 @@ namespace Spectre.Console.Tests.Unit
|
|||||||
public void Should_Hide_Completed_Tasks()
|
public void Should_Hide_Completed_Tasks()
|
||||||
{
|
{
|
||||||
// Given
|
// Given
|
||||||
var task = default(ProgressTask);
|
var taskFinished = default(ProgressTask);
|
||||||
|
var taskInProgress1 = default(ProgressTask);
|
||||||
|
var taskInProgress2 = default(ProgressTask);
|
||||||
var console = new FakeAnsiConsole(ColorSystem.TrueColor, width: 10);
|
var console = new FakeAnsiConsole(ColorSystem.TrueColor, width: 10);
|
||||||
|
|
||||||
var progress = new Progress(console)
|
var progress = new Progress(console)
|
||||||
@ -201,8 +203,11 @@ namespace Spectre.Console.Tests.Unit
|
|||||||
// When
|
// When
|
||||||
progress.Start(ctx =>
|
progress.Start(ctx =>
|
||||||
{
|
{
|
||||||
task = ctx.AddTask("foo");
|
taskInProgress1 = ctx.AddTask("foo");
|
||||||
task.Value = task.MaxValue;
|
taskFinished = ctx.AddTask("bar");
|
||||||
|
taskInProgress2 = ctx.AddTask("baz");
|
||||||
|
taskInProgress2.Increment(20);
|
||||||
|
taskFinished.Value = taskFinished.MaxValue;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
@ -211,7 +216,8 @@ namespace Spectre.Console.Tests.Unit
|
|||||||
.ShouldBe(
|
.ShouldBe(
|
||||||
"[?25l" + // Hide cursor
|
"[?25l" + // Hide cursor
|
||||||
" \n" + // top padding
|
" \n" + // top padding
|
||||||
"…\n" + // hidden task
|
"[38;5;8m━━━━━━━━━━[0m\n" + // taskInProgress1
|
||||||
|
"[38;5;11m━━[0m[38;5;8m━━━━━━━━[0m\n" + // taskInProgress2
|
||||||
" \n" + // bottom padding
|
" \n" + // bottom padding
|
||||||
"[?25h"); // show cursor
|
"[?25h"); // show cursor
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user