diff --git a/app/src/DashboardPage.js b/app/src/DashboardPage.js index cdccb3ea..f9f50679 100644 --- a/app/src/DashboardPage.js +++ b/app/src/DashboardPage.js @@ -15,7 +15,6 @@ import { ActionInput, Button, Divider, - Group, Header, Icon, Message, diff --git a/app/src/components/ui/ui-layout.cy.js b/app/src/components/ui/ui-layout.cy.js index 54299f63..51f0a29c 100644 --- a/app/src/components/ui/ui-layout.cy.js +++ b/app/src/components/ui/ui-layout.cy.js @@ -551,9 +551,18 @@ describe('two choices of equal weight are split down the middle', () => { ).to.equal(0)); expect(parseFloat(styles.borderRadius), 'and no disc').to.equal(0); - // Padded enough to actually open a gap, rather than sitting on the line unbroken. + // Padded enough to actually open a gap, rather than sitting on the line unbroken... expect(parseFloat(styles.paddingTop), 'padded enough to break the rule') .to.be.greaterThan(0); + /* + * ...but its OWN padding, not a half's. `.wrolpi-or-split > *` would lay this out as + * a half if it were not excluded, and it currently escapes on source order alone -- + * same specificity, declared later. Reordering the two blocks would quadruple the gap + * and an assertion that only read "greater than zero" would not notice. + */ + const half = getComputedStyle($label[0].parentElement.children[0]); + expect(parseFloat(styles.paddingTop), "the word's own padding, not a half's") + .to.be.lessThan(parseFloat(half.paddingTop)); }); }); }); @@ -2322,6 +2331,30 @@ describe('theme tokens actually resolve', () => { }); }); +describe('the video page keeps its phone layout edge to edge', () => { + it('drops the inset below the tablet breakpoint, as every other page does', () => { + /* + * The other branch of `.wrolpi-page-inset`. Below 699px a page has no side padding at all, + * so the video page must not either -- and with cypress defaulting to a 500px viewport this + * is the branch the rest of the suite runs in, which makes leaving it unasserted worse than + * it looks: a regression that padded phones would show up nowhere. + */ + cy.viewport(400, 700); + cy.mountUI(
About
); + + cy.get('.wrolpi-page-inset').should(($inset) => { + const styles = getComputedStyle($inset[0]); + expect(parseFloat(styles.paddingLeft), 'no left inset on a phone').to.equal(0); + expect(parseFloat(styles.paddingRight), 'nor right').to.equal(0); + + // And the panel really does reach the edge, not just declare that it may. + const panel = $inset[0].querySelector('.wrolpi-panel').getBoundingClientRect(); + expect(panel.left, 'the panel reaches the edge') + .to.be.closeTo($inset[0].getBoundingClientRect().left, 0.5); + }); + }); +}); + describe("a video's duration chip belongs to the theme, not to the poster", () => { /* * The chip was a literal `#ffffff` with black text. The poster under it IS filtered by night @@ -2343,6 +2376,16 @@ describe("a video's duration chip belongs to the theme, not to the poster", () = .to.equal(panel.backgroundColor); expect(chip.color, 'and the theme text').to.equal(panel.color); + /* + * And an edge. The chip is painted with `--panel`, so on a poster near that color + * -- a pale sky in light, most screenshots -- the border is the only thing telling + * the two apart. Losing it leaves every contrast assertion above still green. + */ + expect(parseFloat(chip.borderTopWidth), 'has an edge').to.be.greaterThan(0); + expect(chip.borderTopColor, 'the theme border') + .to.equal(toRgb(getComputedStyle(document.documentElement) + .getPropertyValue('--border'))); + // And still readable, which is what it is for: a length nobody can read is chrome. expect(contrast(chip.color, chip.backgroundColor), 'legible') .to.be.at.least(4.5); @@ -2360,7 +2403,14 @@ describe("a video's duration chip belongs to the theme, not to the poster", () = cy.get('.duration-overlay').should(($chip) => { const chip = getComputedStyle($chip[0]); - const page = getComputedStyle(document.documentElement).backgroundColor; + /* + * `--bg` read as a token, not `html`'s computed background. Tokens paint `--bg` on + * BODY, so `html` comes back `rgba(0, 0, 0, 0)` -- which `luminance` reads as black, + * making this "no brighter than black + slack" rather than the claim in its name. It + * still failed the white chip, so it caught the reported bug by accident of the + * comparison rather than by measuring the thing it says it measures. + */ + const page = toRgb(getComputedStyle(document.documentElement).getPropertyValue('--bg')); expect(luminance(chip.backgroundColor), 'no brighter than the page it sits on') .to.be.at.most(luminance(page) + 0.05); }); diff --git a/app/src/components/ui/ui.css b/app/src/components/ui/ui.css index 22bf8985..f2676142 100644 --- a/app/src/components/ui/ui.css +++ b/app/src/components/ui/ui.css @@ -1397,7 +1397,13 @@ html[data-theme="amber"] .wrolpi-progress-fill { position: relative; } -.wrolpi-or-split > * { +/* + * `:not(.wrolpi-or-label)` here for the same reason as the border rule below: the label is a third + * child of the grid and this would otherwise lay it out and pad it as though it were a half. It + * only escaped because `.wrolpi-or-label` has the same specificity and comes later -- reorder the + * two blocks and the word takes the half's 1.5rem padding instead of its own 0.375rem. + */ +.wrolpi-or-split > *:not(.wrolpi-or-label) { display: flex; align-items: center; justify-content: center;