mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-12-27 19:25:47 +08:00
Fix line ending problem with text
This commit is contained in:
@@ -95,6 +95,29 @@ namespace Spectre.Console.Tests.Unit
|
||||
console.Lines[1].ShouldBe(" ");
|
||||
console.Lines[2].ShouldBe("Qux Corgi");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Should_Add_Empty_Row_At_The_End()
|
||||
{
|
||||
// Given
|
||||
var console = new PlainConsole(width: 80);
|
||||
var grid = new Grid();
|
||||
grid.AddColumns(2);
|
||||
grid.AddRow("Foo", "Bar");
|
||||
grid.AddEmptyRow();
|
||||
grid.AddRow("Qux", "Corgi");
|
||||
grid.AddEmptyRow();
|
||||
|
||||
// When
|
||||
console.Render(grid);
|
||||
|
||||
// Then
|
||||
console.Lines.Count.ShouldBe(4);
|
||||
console.Lines[0].ShouldBe("Foo Bar ");
|
||||
console.Lines[1].ShouldBe(" ");
|
||||
console.Lines[2].ShouldBe("Qux Corgi");
|
||||
console.Lines[3].ShouldBe(" ");
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -62,6 +62,20 @@ namespace Spectre.Console.Tests.Unit
|
||||
fixture.RawOutput.ShouldBe("Hello\n\nWorld");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Should_Write_Line_Breaks_At_End()
|
||||
{
|
||||
// Given
|
||||
var fixture = new PlainConsole(width: 5);
|
||||
var text = new Text("Hello\n\nWorld\n\n");
|
||||
|
||||
// When
|
||||
fixture.Render(text);
|
||||
|
||||
// Then
|
||||
fixture.RawOutput.ShouldBe("Hello\n\nWorld\n\n");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(5, "Hello World", "Hello\nWorld")]
|
||||
[InlineData(10, "Hello Sweet Nice World", "Hello \nSweet Nice\nWorld")]
|
||||
|
||||
Reference in New Issue
Block a user