Clean up public API

* Make things a bit more consistent
* Add extension methods to configure things like tables, panels and grids.
This commit is contained in:
Patrik Svensson
2020-08-26 15:03:49 +02:00
committed by Patrik Svensson
parent c111c7d463
commit 31f117aed0
24 changed files with 569 additions and 266 deletions

View File

@@ -81,7 +81,7 @@ namespace Spectre.Console.Tests.Unit
// Given
var console = new PlainConsole(width: 80);
var text = new Panel(
Text.Markup("I heard [underline on blue]you[/] like 📦\n\n\n\nSo I put a 📦 in a 📦"));
new Markup("I heard [underline on blue]you[/] like 📦\n\n\n\nSo I put a 📦 in a 📦"));
// When
console.Render(text);

View File

@@ -10,20 +10,26 @@ namespace Spectre.Console.Tests.Unit
[Fact]
public void Should_Consider_The_Longest_Word_As_Minimum_Width()
{
// Given
var text = new Text("Foo Bar Baz\nQux\nLol mobile");
// When
var result = ((IRenderable)text).Measure(new RenderContext(Encoding.Unicode, false), 80);
// Then
result.Min.ShouldBe(6);
}
[Fact]
public void Should_Consider_The_Longest_Line_As_Maximum_Width()
{
// Given
var text = new Text("Foo Bar Baz\nQux\nLol mobile");
// When
var result = ((IRenderable)text).Measure(new RenderContext(Encoding.Unicode, false), 80);
// Then
result.Max.ShouldBe(11);
}