mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-01 01:25:27 +08:00 
			
		
		
		
	Improve the unit test around HideCompleted
This commit is contained in:
		| @@ -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 | ||||||
| @@ -210,9 +215,10 @@ namespace Spectre.Console.Tests.Unit | |||||||
|                 .NormalizeLineEndings() |                 .NormalizeLineEndings() | ||||||
|                 .ShouldBe( |                 .ShouldBe( | ||||||
|                     "[?25l" + // Hide cursor |                     "[?25l" + // Hide cursor | ||||||
|                     " \n" + // top padding |                     "          \n" + // top padding | ||||||
|                     "…\n" + // hidden task |                     "[38;5;8m━━━━━━━━━━[0m\n" + // taskInProgress1 | ||||||
|                     " \n" + // bottom padding |                     "[38;5;11m━━[0m[38;5;8m━━━━━━━━[0m\n" + // taskInProgress2 | ||||||
|  |                     "          \n" + // bottom padding | ||||||
|                     "[?25h"); // show cursor |                     "[?25h"); // show cursor | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 stf
					stf