Merge pull request 'Fix six failing tests' (#62) from fix/failing-tests into main
Reviewed-on: #62
This commit was merged in pull request #62.
This commit is contained in:
commit
abf4f45cd5
3 files changed
+31
-12
No files matched your search
@@ -239,7 +239,7 @@ public sealed partial class RouteSmokeTests : IDisposable
|
|||||||
var client = _factory.CreateClient();
|
var client = _factory.CreateClient();
|
||||||
|
|
||||||
var posts = await client.GetStringAsync(new Uri("/posts", UriKind.Relative));
|
var posts = await client.GetStringAsync(new Uri("/posts", UriKind.Relative));
|
||||||
posts.ShouldContain("Beiträge"); // heading from the page title
|
WebUtility.HtmlDecode(posts).ShouldContain("Beiträge"); // heading from the page title; the "ä" is encoded
|
||||||
posts.ShouldContain("Neuigkeiten aus dem Elternbeirat."); // the page body
|
posts.ShouldContain("Neuigkeiten aus dem Elternbeirat."); // the page body
|
||||||
|
|
||||||
var events = await client.GetStringAsync(new Uri("/events", UriKind.Relative));
|
var events = await client.GetStringAsync(new Uri("/events", UriKind.Relative));
|
||||||
@@ -375,8 +375,9 @@ public sealed partial class RouteSmokeTests : IDisposable
|
|||||||
|
|
||||||
html.ShouldContain(">Willkommen</h1>");
|
html.ShouldContain(">Willkommen</h1>");
|
||||||
html.ShouldNotContain(">Elternbeirat der IGMH</h1>"); // the fallback title
|
html.ShouldNotContain(">Elternbeirat der IGMH</h1>"); // the fallback title
|
||||||
html.ShouldContain("""<a class="btn btn-primary" href="/events">""");
|
// Scoped CSS adds a b-… attribute after href, so the tag is not closed there.
|
||||||
html.ShouldContain("""<a class="btn btn-secondary" href="/contact">""");
|
html.ShouldMatch("""<a class="btn btn-primary" href="/events"[\s>]""");
|
||||||
|
html.ShouldMatch("""<a class="btn btn-secondary" href="/contact"[\s>]""");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -441,7 +442,7 @@ public sealed partial class RouteSmokeTests : IDisposable
|
|||||||
var html = await client.GetStringAsync(new Uri("/events", UriKind.Relative));
|
var html = await client.GetStringAsync(new Uri("/events", UriKind.Relative));
|
||||||
|
|
||||||
Regex.Count(html, Regex.Escape("Sitzungen und Veranstaltungen auf einen Blick.")).ShouldBe(1);
|
Regex.Count(html, Regex.Escape("Sitzungen und Veranstaltungen auf einen Blick.")).ShouldBe(1);
|
||||||
html.ShouldContain("""<a class="btn btn-secondary" href="/events.ics">""");
|
html.ShouldMatch("""<a class="btn btn-secondary" href="/events.ics"[\s>]""");
|
||||||
html.ShouldContain("Kalender abonnieren");
|
html.ShouldContain("Kalender abonnieren");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,14 +451,15 @@ public sealed partial class RouteSmokeTests : IDisposable
|
|||||||
{
|
{
|
||||||
var client = _factory.CreateClient();
|
var client = _factory.CreateClient();
|
||||||
|
|
||||||
var html = await client.GetStringAsync(new Uri("/events", UriKind.Relative));
|
// Decoded because the dash in "20.–22. Juli" is written as an entity.
|
||||||
|
var html = WebUtility.HtmlDecode(await client.GetStringAsync(new Uri("/events", UriKind.Relative)));
|
||||||
|
|
||||||
var past = PastEvents().Match(html);
|
var past = PastEvents().Match(html);
|
||||||
past.Success.ShouldBeTrue();
|
past.Success.ShouldBeTrue();
|
||||||
past.Value.ShouldContain("Vergangene Termine anzeigen (2)");
|
past.Value.ShouldContain("Vergangene Termine anzeigen (2)");
|
||||||
past.Value.ShouldContain("Infoabend Klasse 5");
|
past.Value.ShouldContain("Infoabend Klasse 5");
|
||||||
past.Value.ShouldNotContain("Elternbeiratssitzung"); // upcoming, not past
|
past.Value.ShouldNotContain("Elternbeiratssitzung"); // upcoming, not past
|
||||||
past.Value.ShouldContain("""<h3 class="past-events-year">2026</h3>""");
|
past.Value.ShouldMatch("""<h3 class="past-events-year"[^>]*>2026</h3>""");
|
||||||
past.Value.ShouldContain("10. September"); // day without weekday or year
|
past.Value.ShouldContain("10. September"); // day without weekday or year
|
||||||
past.Value.ShouldContain("19:00 Uhr"); // the time stays, after the title
|
past.Value.ShouldContain("19:00 Uhr"); // the time stays, after the title
|
||||||
past.Value.ShouldContain("20.–22. Juli"); // several days as a span
|
past.Value.ShouldContain("20.–22. Juli"); // several days as a span
|
||||||
|
|||||||
@@ -34,6 +34,15 @@ public static class EventDateFormat
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const string DayMonth = "d. MMMM";
|
private const string DayMonth = "d. MMMM";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The short months for the calendar sheet, January first, without periods.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Fixed here so they do not depend on the host's ICU version; see <see cref="SheetMonth"/>.
|
||||||
|
/// </remarks>
|
||||||
|
private static readonly string[] SheetMonths =
|
||||||
|
["Jan", "Feb", "März", "Apr", "Mai", "Juni", "Juli", "Aug", "Sept", "Okt", "Nov", "Dez"];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Formats the date range of an event.
|
/// Formats the date range of an event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -76,10 +85,16 @@ public static class EventDateFormat
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Returned in normal case; the sheet's CSS sets it in capitals. The period of the
|
/// Returned in normal case; the sheet's CSS sets it in capitals. The period of the
|
||||||
/// abbreviation (<c>Okt.</c>) is dropped because on a sheet it reads as a stray dot.
|
/// abbreviation (<c>Okt.</c>) is dropped because on a sheet it reads as a stray dot.
|
||||||
|
/// <para>
|
||||||
|
/// Taken from <see cref="SheetMonths"/>, not from the culture's <c>MMM</c>
|
||||||
|
/// format: that comes from the ICU data of the host, and newer CLDR versions
|
||||||
|
/// abbreviate March as <c>Mär.</c> instead of <c>März</c>, so the sheet
|
||||||
|
/// would change with the base image.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <seealso cref="CalendarSheet"/>
|
/// <seealso cref="CalendarSheet"/>
|
||||||
public static string SheetMonth(DateTime value)
|
public static string SheetMonth(DateTime value)
|
||||||
=> value.ToString("MMM", Cultures.German).TrimEnd('.');
|
=> SheetMonths[value.Month - 1];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The day of the month for the large number on a calendar sheet.
|
/// The day of the month for the large number on a calendar sheet.
|
||||||
|
|||||||
@@ -108,8 +108,9 @@ public static partial class Markdown
|
|||||||
/// a list or a <c>:::</c> block is rarely a sentence that describes the page.
|
/// a list or a <c>:::</c> block is rarely a sentence that describes the page.
|
||||||
/// <para>
|
/// <para>
|
||||||
/// A sentence ends at <c>.</c>, <c>!</c> or <c>?</c> followed by a space or
|
/// A sentence ends at <c>.</c>, <c>!</c> or <c>?</c> followed by a space or
|
||||||
/// the end. A period after a single letter or a number does not count, so
|
/// the end. A period after a single letter or a number of one or two digits
|
||||||
/// <c>z. B.</c> and <c>13. November</c> do not cut the sentence short. A
|
/// does not count, so <c>z. B.</c> and <c>13. November</c> do not cut the
|
||||||
|
/// sentence short, while a year such as <c>2025.</c> still ends it. A
|
||||||
/// longer abbreviation such as <c>bzw.</c> still does; that costs the rest
|
/// longer abbreviation such as <c>bzw.</c> still does; that costs the rest
|
||||||
/// of a teaser, never the page.
|
/// of a teaser, never the page.
|
||||||
/// </para>
|
/// </para>
|
||||||
@@ -276,10 +277,11 @@ public static partial class Markdown
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Matches the end mark of a sentence: <c>.</c>, <c>!</c> or <c>?</c> before a
|
/// Matches the end mark of a sentence: <c>.</c>, <c>!</c> or <c>?</c> before a
|
||||||
/// space or the end, unless it follows a lone letter (<c>z.</c>) or a number
|
/// space or the end, unless it follows a lone letter (<c>z.</c>) or an ordinal
|
||||||
/// (<c>13.</c>).
|
/// of one or two digits (<c>13.</c>). A longer number is a year (<c>2025.</c>),
|
||||||
|
/// which German does not use as an ordinal, so its period ends the sentence.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[GeneratedRegex(@"(?<!\b\p{L}|\b\d+)[.!?](?=\s|$)")]
|
[GeneratedRegex(@"(?<!\b\p{L}|\b\d{1,2})[.!?](?=\s|$)")]
|
||||||
private static partial Regex SentenceEnd();
|
private static partial Regex SentenceEnd();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in new issue
Block a user