Add post and event cards, shared calendar sheet and per-event ICS; rework past events and next-event card
This commit is contained in:
1 parent
d328adac5c
commit
b2dc033de1
33 files changed
+1150
-206
No files matched your search
@@ -125,4 +125,63 @@ public class MarkdownTests
|
||||
[InlineData("::: hinweis\nText im Baustein.\n:::")]
|
||||
public void First_sentence_is_empty_without_a_top_level_paragraph(string? markdown) =>
|
||||
Markdown.FirstSentence(markdown).ShouldBe("");
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
[InlineData("## Nur eine Überschrift")]
|
||||
public void Teaser_is_empty_without_paragraph_text(string? markdown) =>
|
||||
Markdown.Teaser(markdown).ShouldBe("");
|
||||
|
||||
[Fact]
|
||||
public void Teaser_keeps_a_short_body_whole() =>
|
||||
Markdown.Teaser("Kurzer Text.").ShouldBe("Kurzer Text.");
|
||||
|
||||
[Fact]
|
||||
public void Teaser_removes_markdown_and_skips_headings()
|
||||
{
|
||||
// Emphasis and link markup go, link text stays; the heading would repeat the
|
||||
// card title, so it is left out. Paragraphs and list items are joined.
|
||||
var teaser = Markdown.Teaser(
|
||||
"## Rückblick\n\nDer **Basar** war ein [Erfolg](/posts).\n\n- Danke an alle\n- Bis bald");
|
||||
|
||||
teaser.ShouldBe("Der Basar war ein Erfolg. Danke an alle Bis bald");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Teaser_cuts_a_long_body_at_a_word_boundary()
|
||||
{
|
||||
var teaser = Markdown.Teaser("Der Basar war ein voller Erfolg.", 20);
|
||||
|
||||
// 20 characters end inside "voller"; the cut falls back to the space before it.
|
||||
teaser.ShouldBe("Der Basar war ein…");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Teaser_keeps_a_word_that_ends_exactly_at_the_limit() =>
|
||||
Markdown.Teaser("Der Basar war ein voller Erfolg.", 17).ShouldBe("Der Basar war ein…");
|
||||
|
||||
[Fact]
|
||||
public void Teaser_drops_punctuation_left_at_the_cut() =>
|
||||
Markdown.Teaser("Liebe Eltern, der Basar war schön.", 14).ShouldBe("Liebe Eltern…");
|
||||
|
||||
[Fact]
|
||||
public void Teaser_cuts_a_single_overlong_word_hard() =>
|
||||
Markdown.Teaser("Donaudampfschifffahrtsgesellschaft", 10).ShouldBe("Donaudampf…");
|
||||
|
||||
[Fact]
|
||||
public void Teaser_defaults_to_160_characters_plus_ellipsis()
|
||||
{
|
||||
var body = string.Join(' ', Enumerable.Repeat("Wort", 100)); // 499 characters
|
||||
|
||||
var teaser = Markdown.Teaser(body);
|
||||
|
||||
teaser.Length.ShouldBeLessThanOrEqualTo(Markdown.TeaserLength + 1);
|
||||
teaser.ShouldEndWith("Wort…");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Teaser_rejects_a_length_of_zero() =>
|
||||
Should.Throw<ArgumentOutOfRangeException>(() => Markdown.Teaser("Text", 0));
|
||||
}
|
||||
Reference in new issue
Block a user