fix: table title's first letter is getting capitalized by default (#652)

fix for #638
This commit is contained in:
zameer fouzan 2021-12-07 17:33:30 +05:30 committed by GitHub
parent 55633b59fa
commit 37f661a963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 1 deletions

View File

@ -163,7 +163,7 @@ namespace Spectre.Console
return Array.Empty<Segment>();
}
var paragraph = new Markup(header.Text.CapitalizeFirstLetter(), header.Style ?? defaultStyle)
var paragraph = new Markup(header.Text, header.Style ?? defaultStyle)
.Alignment(Justify.Center)
.Overflow(Overflow.Ellipsis);

View File

@ -0,0 +1,8 @@
hello world
╭────────┬────────┬───────╮
│ Foo │ Bar │ Baz │
├────────┼────────┼───────┤
│ Qux │ Corgi │ Waldo │
│ Grault │ Garply │ Fred │
╰────────┴────────┴───────╯
goodbye world

View File

@ -481,6 +481,26 @@ namespace Spectre.Console.Tests.Unit
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("Render_Title_Caption_LowerCase")]
public Task Should_Render_Table_Without_Capitalizing_First_Letter()
{
// Given
var console = new TestConsole();
var table = new Table { Border = TableBorder.Rounded };
table.Title = new TableTitle("hello world");
table.Caption = new TableTitle("goodbye world");
table.AddColumns("Foo", "Bar", "Baz");
table.AddRow("Qux", "Corgi", "Waldo");
table.AddRow("Grault", "Garply", "Fred");
// When
console.Write(table);
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("Render_Fold")]
public Task Should_Render_With_Folded_Text_Table_Correctly()