diff --git a/design/system/screens/screens.css b/design/system/screens/screens.css index 1f65a9d..a82ee8a 100644 --- a/design/system/screens/screens.css +++ b/design/system/screens/screens.css @@ -14,12 +14,18 @@ color: var(--fl-color-warning-solid); } -/* Dashboard (System): the term and its value on one line in a card of a side - column. The description list puts them side by side only from 30rem of its - own width. Unnecessary with a modifier that keeps a pair on one line. */ +/* Dashboard (System), entry editor (Status, Info): the term and its value on + one line in a card of a side column. The description list puts them side by + side only from 30rem of its own width. The term keeps its width, and the + value takes the rest, at its end, and wraps when it is long. Unnecessary + with a modifier that keeps a pair on one line. */ .screen-facts > .fl-description-list__item { - grid-template-columns: minmax(0, 1fr) auto; + grid-template-columns: auto minmax(0, 1fr); align-items: baseline; + + & > dd { + text-align: end; + } } /* Frame (entry editor): the trail ends with the title of the entry, which diff --git a/gallery/Gallery.Client/wwwroot/gallery.css b/gallery/Gallery.Client/wwwroot/gallery.css index 55d0da2..26d47f1 100644 --- a/gallery/Gallery.Client/wwwroot/gallery.css +++ b/gallery/Gallery.Client/wwwroot/gallery.css @@ -144,10 +144,15 @@ body.gallery { color: var(--fl-color-warning-solid); } -/* Dashboard (System): the term and its value on one line in a card of a side column. */ +/* Dashboard (System), entry editor (Status, Info): the term and its value on one line in a card of a side column. The + term keeps its width, and the value takes the rest, at its end, and wraps when it is long. */ .gallery-screen-facts > .fl-description-list__item { - grid-template-columns: minmax(0, 1fr) auto; + grid-template-columns: auto minmax(0, 1fr); align-items: baseline; + + & > dd { + text-align: end; + } } /* Entry editor: the order of the blocks as the draft holds it, under the list. */ diff --git a/tests/FluentCMS.Components.Browser/Screens/FactsTests.cs b/tests/FluentCMS.Components.Browser/Screens/FactsTests.cs new file mode 100644 index 0000000..6c92933 --- /dev/null +++ b/tests/FluentCMS.Components.Browser/Screens/FactsTests.cs @@ -0,0 +1,35 @@ +using FluentCMS.Components.Browser.Harness; +using Microsoft.Playwright; + +namespace FluentCMS.Components.Browser.Screens; + +// The facts of a side card: a term and its value on one line. A long value must not take the place of its term. +public sealed class FactsTests(GalleryFixture gallery) +{ + private const string Overlaps = """ + list => [...list.querySelectorAll(':scope > .fl-description-list__item')].filter(item => { + const term = item.querySelector(':scope > dt'), value = item.querySelector(':scope > dd'); + const range = document.createRange(); + range.selectNodeContents(term); + const text = range.getBoundingClientRect(), box = value.getBoundingClientRect(); + return text.right > box.left + 0.5 && text.left < box.right - 0.5 && text.bottom > box.top && text.top < box.bottom; + }).map(item => item.querySelector(':scope > dt').textContent) + """; + + [Theory] + [ModeData(Check = PageCheck.Look, Pages = ["content-list/entry", "dashboard"])] + public async Task NoTermIsDrawnUnderItsValue(RenderMode mode, string path) + { + foreach (int width in new[] { 1280, 320 }) + { + await using GalleryPage sample = await gallery.OpenAsync(mode, path, new() { Width = width }); + // The dashboard has the System card; the editor has the Status and the Info card. + IReadOnlyList lists = await sample.Page.Locator("dl.gallery-screen-facts").AllAsync(); + Assert.Equal(path == "dashboard" ? 1 : 2, lists.Count); + foreach (ILocator list in lists) + { + Assert.Empty(await list.EvaluateAsync(Overlaps)); + } + } + } +} diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.dark-compact-rtl.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.dark-compact-rtl.png index 816b219..0866c5e 100644 Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.dark-compact-rtl.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.dark-compact-rtl.png differ diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.forced-320.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.forced-320.png index c811b96..26ef2d2 100644 Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.forced-320.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.forced-320.png differ diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.light.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.light.png index 5f53222..5c82c30 100644 Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.light.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.server.light.png differ diff --git a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.static.light.png b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.static.light.png index 2cd9076..b5e68a2 100644 Binary files a/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.static.light.png and b/tests/FluentCMS.Components.Browser/Visual/Baselines/content-list-entry/content.static.light.png differ