mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00
Adding test and update render to fix issue with rendering separator when headers are hidden fixing issue 1391.
This commit is contained in:
parent
eb38f76a6a
commit
ff7282ecb8
@ -150,9 +150,9 @@ internal static class TableRenderer
|
|||||||
result.Add(Segment.LineBreak);
|
result.Add(Segment.LineBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show row separator?
|
// Show row separator, if headers are hidden show separator after the first row
|
||||||
if (context.Border.SupportsRowSeparator && context.ShowRowSeparators
|
if (context.Border.SupportsRowSeparator && context.ShowRowSeparators
|
||||||
&& !isFirstRow && !isLastRow)
|
&& (!isFirstRow || (isFirstRow && !context.ShowHeaders)) && !isLastRow)
|
||||||
{
|
{
|
||||||
var hasVisibleFootes = context is { ShowFooters: true, HasFooters: true };
|
var hasVisibleFootes = context is { ShowFooters: true, HasFooters: true };
|
||||||
var isNextLastLine = index == context.Rows.Count - 2;
|
var isNextLastLine = index == context.Rows.Count - 2;
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
┌────────┬────────┐
|
||||||
|
│ Qux │ Corgi │
|
||||||
|
├────────┼────────┤
|
||||||
|
│ Waldo │ Grault │
|
||||||
|
├────────┼────────┤
|
||||||
|
│ Garply │ Fred │
|
||||||
|
└────────┴────────┘
|
@ -159,6 +159,29 @@ public sealed class TableTests
|
|||||||
return Verifier.Verify(console.Output);
|
return Verifier.Verify(console.Output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[Expectation("Render_Row_Separators_No_Header")]
|
||||||
|
public Task Should_Render_Table_With_Row_Separators_No_Header_Correctly()
|
||||||
|
{
|
||||||
|
// Given
|
||||||
|
var console = new TestConsole();
|
||||||
|
var table = new Table();
|
||||||
|
|
||||||
|
table.ShowRowSeparators();
|
||||||
|
table.HideHeaders();
|
||||||
|
|
||||||
|
table.AddColumns("Foo", "Bar");
|
||||||
|
table.AddRow("Qux", "Corgi");
|
||||||
|
table.AddRow("Waldo", "Grault");
|
||||||
|
table.AddRow("Garply", "Fred");
|
||||||
|
|
||||||
|
// When
|
||||||
|
console.Write(table);
|
||||||
|
|
||||||
|
// Then
|
||||||
|
return Verifier.Verify(console.Output);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[Expectation("Render_EA_Character")]
|
[Expectation("Render_EA_Character")]
|
||||||
public Task Should_Render_Table_With_EA_Character_Correctly()
|
public Task Should_Render_Table_With_EA_Character_Correctly()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user