mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 19:36:20 -05:00
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
85eeb1cd8d
commit
bb14bf4074
9 changed files with 125 additions and 65 deletions
|
|
@ -142,15 +142,19 @@ describe('a page stacks its own blocks', () => {
|
|||
<Panel>Calculators</Panel>
|
||||
</div>);
|
||||
|
||||
cy.get('.wrolpi-panel').should(($panels) => {
|
||||
const gaps = gapsBetween($panels);
|
||||
cy.get('.wrolpi-stack').should(($stack) => {
|
||||
/*
|
||||
* Measured against the stack's own `row-gap` rather than a pixel range. The range was
|
||||
* 12-28px, which assumes the default `--ui-scale`: at a larger scale the gap grows past
|
||||
* 28 and a correct layout would have failed the assertion. A separate test covers the
|
||||
* ratio; this one is about the panels really being that far apart.
|
||||
*/
|
||||
const declared = parseFloat(getComputedStyle($stack[0]).rowGap);
|
||||
expect(declared, 'the stack declares a gap').to.be.greaterThan(0);
|
||||
|
||||
const gaps = gapsBetween($stack[0].querySelectorAll('.wrolpi-panel'));
|
||||
expect(gaps, 'both pairs measured').to.have.length(2);
|
||||
gaps.forEach((gap) => {
|
||||
// Enough to read as a seam rather than a heavier border ...
|
||||
expect(gap, 'gap between panels').to.be.at.least(12);
|
||||
// ... and not so much that one page reads as unrelated cards.
|
||||
expect(gap, 'gap between panels').to.be.at.most(28);
|
||||
});
|
||||
gaps.forEach((gap) => expect(gap, 'gap between panels').to.be.closeTo(declared, 0.5));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -243,9 +247,14 @@ describe('a page stacks its own blocks', () => {
|
|||
<Panel>Also shown</Panel>
|
||||
</div>);
|
||||
|
||||
cy.get('.wrolpi-panel:visible').should(($panels) => {
|
||||
expect($panels, 'the hidden panel is not measured').to.have.length(2);
|
||||
expect(gapsBetween($panels)[0], 'one gap, not two').to.be.at.most(28);
|
||||
// One gap, not two: measured against the declared gap rather than a pixel ceiling, which
|
||||
// would have false-failed at a larger interface scale instead of catching a doubled gap.
|
||||
cy.get('.wrolpi-stack').should(($stack) => {
|
||||
const declared = parseFloat(getComputedStyle($stack[0]).rowGap);
|
||||
const shown = $stack[0].querySelectorAll('.wrolpi-panel:not([style*="none"])');
|
||||
const visible = [...shown].filter((el) => el.offsetParent !== null);
|
||||
expect(visible, 'the hidden panel is not measured').to.have.length(2);
|
||||
expect(gapsBetween(visible)[0], 'one gap, not two').to.be.closeTo(declared, 0.5);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue