Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# makeabox: notes for agents

## Worktrees and locks

- Create your own worktree without asking: `git worktree add -b <branch> .claude/worktrees/<name> origin/main`, then enter it by path and seed it with `~/.agents/bin/setup-worktree`. `.claude/` is git-ignored.
- Name the branch with `~/.agents/bin/create-branch-name <up to 4 words>`.
- Before writing, claim each file with `alock acquire <path> "<why>" -u "$REDIS_URL"`, one path per call (`acquire` takes a single scope). Release them with `alock release-all -u "$REDIS_URL"` when the PR is open.
- Keep unrelated work in separate PRs: a fix to an existing feature merges on its own, before the next feature.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙁 This line says to keep unrelated work in separate PRs, and the agent notes ship in the banner PR. It does no harm, but a separate PR would follow your own rule. Line 5 ("Create your own worktree without asking") also overrides the global ask-first rule for this repo. That looks deliberate; just flagging it so it is a conscious choice.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping it here, deliberately. The PR author asked for this CLAUDE.md in the same session, as part of this work, and the "create your own worktree without asking" line is a rule the author granted for this repo. Moving it to its own PR now would mean rewriting a pushed branch (force-push), which the author's rules forbid. It is one self-contained commit (f3d8ab2), so it can be reverted or cherry-picked on its own. Leaving this thread for the author to resolve.


## Checks

There is no justfile. CI (`.github/workflows/rubyonrails.yml`) runs:

```bash
bundle exec rspec
bundle exec rubocop
bundle exec puma -p 3055 -e development -w 0 -t 1:4 config.ru & # then:
npx cypress run
```

- Ruby comes from rbenv: prefix commands with `eval "$(rbenv init -)" &&`.
- Port 3055 is usually the human's server from the main checkout. Run a worktree's app on another port and point Cypress at it with `CYPRESS_BASE_URL=http://127.0.0.1:3056`.
- Cypress freezes CSS animations when it takes a screenshot, so an animated SVG stroke shows in its undrawn state there. Check animations in a real browser.
149 changes: 149 additions & 0 deletions app/assets/stylesheets/announce.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/* The release banner: a strip of birch plywood that floats out from under the
header. Its left end is cut on a slope, like the front of the box it announces.
The outer element moves and casts the shadow; the plank inside is clipped to
the sloped shape. (A clip-path would cut away a shadow on the same element.) */

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Putting the shadow on the outer element and the clip on .plank is the right fix, and the comment says why, so nobody merges the two back later.

.announce {
--slope: 26px;
--edge: #6b4524; /* the plank's end grain, between the birch and the burnt --char */
--deep: #9c2d0b; /* the beam, darkened: 4.48:1 on birch, 3.12:1 at the plank's darkest edge (fine for 24px text), 6.43:1 under ink */
position: fixed; z-index: 2; /* under the header, which it slides out of, and under the panels */
top: calc(var(--header) + 12px); left: 0; right: 0;
width: fit-content; max-width: min(860px, calc(100vw - 2 * var(--gutter))); margin-inline: auto;
filter: drop-shadow(0 10px 18px rgb(0 0 0 / 0.45));

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙁 This drop-shadow never shows. Filters run before clipping, so the clip-path on line 14 cuts the shadow off along with everything else outside the polygon. To get the floating shadow, put the filter on a wrapper (or on .announce itself) and the clip-path plus birch background on an inner element or a ::after layer.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 93f3383.

opacity: 0;
transform: translateY(-28px);
transition: opacity 0.5s ease-out, transform 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.announce[hidden] { display: none; }
.announce.in { opacity: 1; transform: none; transition-delay: 0.6s; }
.announce.out { opacity: 0; transform: translateY(-28px); transition-duration: 0.3s; transition-delay: 0s; }

/* Once it has landed it rocks gently like a seesaw about its middle, as if it hung
in the air: as the right end rises the left end sinks, and back. ±0.45º moves each
end of the wide banner about 6.4px. */
.announce.in { animation: bob 4.2s ease-in-out 1.4s infinite; }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Bobbing with the separate translate property rather than transform means the keyframes stack on the translate(-50%, 0) centering instead of overwriting it. Neat.

@keyframes bob {
0%, 100% { rotate: 0.45deg; }
50% { rotate: -0.45deg; }
}

.announce .plank {
position: relative;
/* Wide: one row of sketch, release, line, buttons and close, with the small
print under the line, its checkbox lined up with the line's first word. */
display: grid; align-items: center; gap: 6px 14px;
grid-template-columns: auto auto minmax(0, 1fr) auto auto;
grid-template-areas: "sketch release line actions close" ". . never . .";
padding: 10px 12px 8px calc(var(--slope) + 10px);
/* Its thickness shows along the right and bottom, so it reads as a board, not a sticker. */
border-right: 6px solid var(--edge); border-bottom: 6px solid var(--edge);
color: var(--char);
background:
repeating-linear-gradient(97deg, rgb(255 255 255 / 0.07) 0 2px, transparent 2px 9px),
linear-gradient(180deg, var(--birch-light), var(--birch) 60%, var(--birch-dark));
/* The left end is cut on the slope; the top-right corner is mitred at 45º, so the
right edge reads as the board's thickness seen from an angle. */
clip-path: polygon(var(--slope) 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
}

/* The burnt edge along the slope, where the laser cut it, down through the bottom edge. */
.announce .plank::before {
content: ""; position: absolute; inset: 0 0 -6px 0;
clip-path: polygon(var(--slope) 0, calc(var(--slope) + 3px) 0, 3px 100%, 0 100%);
background: var(--char); opacity: 0.85;
}

/* The little side view is drawn by the beam, then the sloped front glows. */
.announce .sketch { grid-area: sketch; overflow: visible; }
.announce .trace {
fill: none; stroke: var(--char); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round;
stroke-dasharray: 100; stroke-dashoffset: 100;
}
.announce.in .trace { animation: trace 1.1s ease-in-out 1s forwards; }
.announce.in .slope { stroke: var(--beam); animation: trace 0.5s ease-out 2.1s forwards, glow 2.4s ease-in-out 2.6s infinite; }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes glow {
0%, 100% { filter: drop-shadow(0 0 1px var(--beam)); }
50% { filter: drop-shadow(0 0 4px var(--amber)); }
}

/* Wide, the release and the line are cells of the plank's grid; narrower, they stack in one. */
.announce .words { display: contents; }
.announce .release {
grid-area: release; font: 600 24px/1 "Barlow Condensed", "Archivo", sans-serif; letter-spacing: 0.02em;
color: var(--deep); text-shadow: 0 1px 0 rgb(255 255 255 / 0.35);
}
.announce .release .v { font-size: 0.7em; margin-right: 1px; }
.announce .line { grid-area: line; font-size: 15px; line-height: 1.3; text-wrap: balance; } /* no lone last word once it wraps */
.announce .line b { font-weight: 750; }

.announce button { flex: none; cursor: pointer; border: 0; }
.announce .actions { grid-area: actions; display: flex; gap: 8px; }
.announce .try, .announce .comment {
padding: 7px 14px; border-radius: 3px;
font: 600 16px/1 "Barlow Condensed", "Archivo", sans-serif; letter-spacing: 0.04em; text-transform: uppercase;
text-decoration: none; cursor: pointer;
}
.announce .try { color: var(--ink); background: var(--char); }
.announce .try:hover { background: var(--deep); }
/* The second call to action: the same shape, drawn in outline. */
.announce .comment { padding: 5px 12px; color: var(--char); border: 2px solid var(--char); }
.announce .comment:hover { color: var(--deep); border-color: var(--deep); }

/* Small print along the bottom edge. */
.announce .never {
grid-area: never; justify-self: start;
display: flex; align-items: center; gap: 6px;
font-size: 12px; line-height: 1; color: var(--char); opacity: 0.8; cursor: pointer;
}
.announce .never:hover { opacity: 1; }
.announce .never input { width: 13px; height: 13px; margin: 0; accent-color: var(--deep); cursor: pointer; }
.announce .close {
grid-area: close; width: 28px; height: 28px; padding: 0; border-radius: 50%;
font-size: 22px; line-height: 1; color: var(--char); background: transparent;
}
.announce .close:hover { background: rgb(61 38 20 / 0.12); }
.announce :focus-visible { outline-color: var(--char); }

/* Where it would cover the heading, it stops floating and takes its place in the
page instead: above the h1, lined up with it. */
@media (max-width: 1180px) {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 At 901-1180px this pushes the control strip below the fold. Once the banner is in the flow before main.bench, the first screen is the header, the banner (about 14px margin plus about 60px), and a .bench that still has min-height: calc(100svh - var(--header)) (generator.css:2). That min-height is only reset at max-width: 900px (generator.css:133). So at 1024 or 1152 wide, the panel with Generate starts about 75px below the fold until the banner is dismissed. The 1000x800 Cypress case only checks the banner against the h1, so it cannot catch this.

Options:

  • Render the banner inside .hero above the h1. This also lines it up without the --gutter margin math.
  • Or subtract its height: .announce:not([hidden]) + .bench { min-height: calc(100svh - var(--header) - <banner height>) }.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this one. Moving the banner above the heading on smaller screens was an explicit request, and being in the flow is what that costs: until it is dismissed the strip sits about 75px lower. It is gone for good after one click. Leaving the thread for the author to resolve.

.announce {
position: relative; z-index: 1; top: auto; left: auto; right: auto;
margin: 14px var(--gutter) 0; max-width: calc(100% - 2 * var(--gutter));
}
}

/* Narrower, the line wraps in a column about half the banner wide, the buttons
stay on its right, and the small print moves to the centre. */
@media (max-width: 900px) {
.announce { width: auto; }
.announce .plank {
grid-template-columns: auto minmax(0, 1fr) auto auto;
grid-template-areas: "sketch words actions close" "never never never never";
}
.announce .words { grid-area: words; display: flex; flex-direction: column; gap: 2px; }
.announce .never { justify-self: center; }
}

@media (max-width: 640px) {
.announce { --slope: 18px; }
.announce.in { animation: none; } /* no rocking on a phone: it sits in the page, still */
.announce .plank { gap: 6px 10px; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "words actions close" "never never never"; }
.announce .sketch { display: none; }
.announce .line { font-size: 14px; }
}

/* A phone has no room for half: the buttons go under the line, close keeps the corner. */
@media (max-width: 480px) {
.announce .plank { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "words close" "actions actions" "never never"; }
.announce .close { align-self: start; }
}

/* base.css already turns every animation and transition off; this puts the
banner and its drawing in their finished state. */
@media (prefers-reduced-motion: reduce) {
.announce, .announce.in, .announce.out { transform: none; }
.announce .trace { stroke-dashoffset: 0; animation: none !important; }
.announce .slope { stroke: var(--beam); }
}
56 changes: 56 additions & 0 deletions app/javascript/controllers/announce_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { Controller } from "@hotwired/stimulus"

// The release banner under the header. It drifts in on every page load until
// the visitor ticks "Do not show again"; that choice is kept in localStorage
// under a key that names the release, so the next release announces itself
// afresh. Closing it, trying the feature or opening the discussion hides it
// for this page only.
export default class extends Controller {
static values = { key: String }
static targets = ["never"]
static outlets = ["generator"]

connect() {
if (this.never) return
this.element.hidden = false

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 At 1180px and below the banner is in the flow, so hidden = false here makes the h1, preview and panel jump down about 75px once the importmap modules have loaded. The banner itself is still at opacity 0 at that point. This happens on every first visit per release, without user input, so it counts as layout shift (CLS). Reserving the space on the server, or animating the height (grid-template-rows: 0fr to 1fr) together with the opacity, would avoid it.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this one either. The banner ships hidden so that someone who already dismissed it never sees a flash. Reserving its space before the script runs would bring back either the flash or an empty gap for those people. A one-time 75px shift on the first visit of a release seems the better trade. Leaving the thread for the author to resolve.

// Two frames later, so the slide-in transition has a starting point.
requestAnimationFrame(() => requestAnimationFrame(() => this.element.classList.add("in")))
}

// Switches the generator to a sloped front, the way choosing it by hand
// would. Through the outlet, a renamed generator throws here instead of the
// button quietly doing nothing.
try() {
const generator = this.generatorOutlet
generator.shapeTarget.value = "sloped"
generator.reshape()
generator.shapeTarget.focus({ preventScroll: true })
generator.shapeTarget.scrollIntoView({ behavior: "smooth", block: "center" })
this.dismiss()
}

// Saves the checkbox the moment it changes, so the choice holds even if the
// visitor never closes the banner.
remember() {
this.never = this.neverTarget.checked
}

dismiss() {
this.element.classList.remove("in")
this.element.classList.add("out")
const hide = () => { this.element.hidden = true }
this.element.addEventListener("transitionend", hide, { once: true })
setTimeout(hide, 600) // reduced motion turns every transition off (base.css), so transitionend never comes
}

get never() {
try { return localStorage.getItem(this.keyValue) === "1" } catch { return false }
}

set never(value) {
try {
if (value) localStorage.setItem(this.keyValue, "1")
else localStorage.removeItem(this.keyValue)
} catch { /* private mode: it shows again next time */ }
}
}
1 change: 1 addition & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
%a{href: '#discussion', data: {action: 'panels#open menu#close', panels_name_param: 'discussion'}} Discussion
%a{href: 'https://github.com/kigster/laser-cutter', target: "_blank", data: {action: 'menu#close'}} GitHub
%a{href: '#support', data: {action: 'panels#open menu#close', panels_name_param: 'support'}} Donate
= render 'shared/announcement'
= yield
= render 'shared/footer'
29 changes: 29 additions & 0 deletions app/views/shared/_announcement.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-# Floats out from under the header to announce what a release brought. Hidden
-# until announce_controller.js shows it, so it never flashes for someone who
-# ticked "Do not show again". Closing it otherwise hides it for this page only.
-# The release is the one this copy describes, not Makeabox::VERSION: bumping the
-# version must not bring back last release's news under a new number.
- release = '5.0'
%aside.announce{hidden: true, 'aria-label': "New in version #{release}",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Rendering it hidden and letting the controller decide (backed by .announce[hidden] { display: none }, needed because display: flex would otherwise win) means no flash for people who dismissed it, and no stray banner without JS.

data: {controller: 'announce', announce_key_value: "makeabox:announce:#{release}",
announce_generator_outlet: '.bench'}}
.plank
%svg.sketch{viewBox: '0 0 48 40', width: 48, height: 40, 'aria-hidden': 'true'}
-# A box seen from the side: upright back, front rising part-way, then leaning back to the top.
%path.trace{d: 'M22 6 H42 V36 H6 V22', pathLength: 100}
%path.trace.slope{d: 'M6 22 L22 6', pathLength: 100}
.words
%strong.release
%span.v v
= release
%span.line
%b Sloped sides.
The front of a box can now lean back at any angle.
.actions
%button.try{type: 'button', data: {action: 'announce#try'}} Try it
-# panels_controller.js on <body> opens the Discussion panel, as the menu link does.
%a.comment{href: '#discussion', data: {action: 'panels#open announce#dismiss', panels_name_param: 'discussion'}} Comment
%button.close{type: 'button', 'aria-label': 'Dismiss', data: {action: 'announce#dismiss'}} &times;
%label.never
%input{type: 'checkbox', data: {announce_target: 'never', action: 'announce#remember'}}
Do not show again
2 changes: 1 addition & 1 deletion app/views/shared/_head.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@

= preload_link_tag 'archivo-variable-latin.woff2', as: 'font', type: 'font/woff2', crossorigin: 'anonymous'
= preload_link_tag 'barlow-condensed-600-latin.woff2', as: 'font', type: 'font/woff2', crossorigin: 'anonymous'
= stylesheet_link_tag 'tokens', 'base', 'generator', 'dialogs', 'sections'
= stylesheet_link_tag 'tokens', 'base', 'generator', 'dialogs', 'sections', 'announce'
= javascript_importmap_tags
= csrf_meta_tags
114 changes: 114 additions & 0 deletions cypress/e2e/announce.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
const KEY = "makeabox:announce:5.0"
const banner = () => cy.get("aside.announce")

describe("the release banner", () => {
beforeEach(() => {
cy.clearLocalStorage()
cy.visit("/")
})

it("floats in under the header and draws the sloped box", () => {
banner().should("be.visible").and("have.class", "in")
banner().should("have.css", "animation-name", "bob")
banner().find(".slope").should("have.css", "stroke-dashoffset", "0px")
cy.screenshot("announce", { capture: "viewport" })
})

it("floats centred under the header on a wide screen", () => {
banner().should("have.class", "in").should("have.css", "position", "fixed").then(($banner) => {
const box = $banner[0].getBoundingClientRect()
const middle = $banner[0].ownerDocument.documentElement.clientWidth / 2 // the viewport less its scrollbar
expect(box.width).to.be.greaterThan(560)
expect(Math.abs(box.left + box.width / 2 - middle)).to.be.lessThan(2)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 The layout is checked by real geometry (centred within 2px against clientWidth without the scrollbar, aligned with the h1 when narrow), not by screenshots. That is what caught the width bug.

})
})

for (const [width, height] of [[1000, 800], [390, 844]]) {
it(`sits above the heading, lined up with it, at ${width}px`, () => {
cy.viewport(width, height)
// Where the layout puts it: the slide-in and the bob only move it visually, so measure with them off.
banner().should("have.class", "in").should("have.css", "position", "relative")
cy.get(".hero h1").then(($h1) => {
const heading = $h1[0].getBoundingClientRect()
const el = Cypress.$("aside.announce")[0]
el.style.transition = el.style.animation = "none"
el.style.transform = el.style.translate = el.style.rotate = "none"
const box = el.getBoundingClientRect()
expect(box.bottom).to.be.at.most(heading.top)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 This .then runs as soon as .in appears. For the next 0.6s the box is still at translateY(-28px), then it overshoots and bobs, so box.bottom <= heading.top gets up to about 28px of free slack, and the result depends on timing. Retry with .should() until getComputedStyle(el).transform === "none", then measure. Also, calling cy.viewport before cy.visit tests the narrow layout from first load rather than after a resize.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a080664.

expect(Math.abs(box.left - heading.left)).to.be.lessThan(2)
})
})
}

// Where the layout puts something: the slide-in and the bob only move it visually.
const settled = () => banner().should("have.class", "in").then(($banner) => {
const el = $banner[0]
el.style.transition = el.style.animation = "none"
el.style.transform = el.style.translate = el.style.rotate = "none"
})
const rect = (selector) => Cypress.$(`aside.announce ${selector}`)[0].getBoundingClientRect()

it("keeps the text and both buttons on one row when wide, with the checkbox under the text", () => {
settled().then(() => {
const line = rect(".line")
const middle = (r) => r.top + r.height / 2
expect(Math.abs(middle(rect(".try")) - middle(line))).to.be.lessThan(4)
expect(Math.abs(middle(rect(".comment")) - middle(line))).to.be.lessThan(4)
expect(Math.abs(rect(".never input").left - line.left)).to.be.lessThan(1)
expect(rect(".never").top).to.be.greaterThan(line.bottom)
})
})

it("wraps the text beside the buttons when narrower, with the checkbox centred", () => {
cy.viewport(800, 800)
settled().then(() => {
const plank = rect(".plank")
const words = rect(".words")
expect(words.width / plank.width).to.be.within(0.35, 0.65)
expect(rect(".try").left).to.be.greaterThan(words.right)
// Centred in the plank's content box: inside the slope's padding and the wood edge.
const css = getComputedStyle(Cypress.$("aside.announce .plank")[0])
const px = (name) => parseFloat(css[name])
const content = (plank.left + px("borderLeftWidth") + px("paddingLeft") + plank.right - px("borderRightWidth") - px("paddingRight")) / 2
const never = rect(".never")
expect(Math.abs(never.left + never.width / 2 - content)).to.be.lessThan(4)
})
})

it("switches the generator to a sloped front when tried", () => {
banner().find(".try").click()
cy.get('[data-generator-target="shape"]').should("have.value", "sloped")
cy.get('[data-generator-target="sloped"]').should("be.visible")
banner().should("have.attr", "hidden")
cy.window().then((win) => expect(win.localStorage.getItem(KEY)).to.be.null)
})

it("opens the discussion when Comment is clicked", () => {
banner().find(".comment").click()
cy.get("dialog#discussion").should("have.attr", "open")
cy.location("hash").should("eq", "#discussion")
banner().should("have.attr", "hidden")
})

it("comes back on the next page load unless told not to", () => {
banner().find(".close").click()
banner().should("have.attr", "hidden")

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 This can pass without the controller ever running, because the server HTML already ships with hidden, and cy.reload does not wait for the controllers to connect. If seen broke (wrong key, a getter that always returns false), the test could still go green. Line 52's upright is the HTML default too. Wait for something the JS draws first (e.g. the stage SVG), then assert hidden and not.have.class("in").

On a related note, lines 43 and 49 only check not.be.visible, which is true as soon as the opacity reaches 0. If hide() regressed, a see-through banner (fixed, z-index 2) would stay over the hero and swallow clicks. Adding banner().should("have.attr", "hidden") there would catch that.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a080664.

cy.reload()
banner().should("be.visible").and("have.class", "in")
})

it("stays gone once Do not show again is ticked", () => {
banner().find(".never input").check()
cy.window().then((win) => expect(win.localStorage.getItem(KEY)).to.eq("1"))
// The server renders it hidden anyway, so prove the controller ran and read its key.
cy.visit("/", { onBeforeLoad: (win) => cy.spy(win.Storage.prototype, "getItem").as("getItem") })
cy.get("@getItem").should("have.been.calledWith", KEY)
banner().should("not.have.class", "in").and("have.attr", "hidden")
cy.get('[data-generator-target="shape"]').should("have.value", "upright")
})

it("forgets the choice when the box is unticked again", () => {
banner().find(".never input").check().uncheck()
cy.window().then((win) => expect(win.localStorage.getItem(KEY)).to.be.null)
})
})
Loading
Loading