# Business Rules: testimonials (unit 2) Rule numbers `BR-REV-nn` are the ones of `homepage-sections/construction/lieve-woorden`; `BR-TR-nn` are new in this feature. Requirement references are to `requirements.md`. ## Rule table | ID | Rule | Status | Source | |---|---|---|---| | BR-REV-01 | Only valid reviews are shown; broken ones are skipped, and of two with the same id the first wins; the order stays | Kept | FR-TR-09 | | BR-REV-02 | No valid review: the section is left out; one review: shown without controls and without counter | Kept (counter added to the "without controls" part) | FR-TR-09 | | BR-REV-03 | The carousel is shown from two reviews on, one review per page | Kept | FR-TR-09 | | BR-REV-04 | Navigation | **Replaced** by BR-TR-01 (no dots) | FR-TR-07 | | BR-REV-05 | The carousel loops; the buttons are never disabled | Kept | FR-TR-09 | | BR-REV-06 | A change slides horizontally; instant under `prefers-reduced-motion` | Kept, now also for swipes and keys (all through the carousel's `instant` flag) | FR-TR-08 | | BR-REV-07 | Every slide has the height of the tallest one | Kept | FR-TR-09 | | BR-REV-08 | Every manual change is announced once, politely, as "Review n van m"; nothing on load | Kept | FR-TR-09 | | BR-REV-09 | Slides are named "Review n van m"; buttons "Vorige review" and "Volgende review" | Kept without the dot labels | FR-TR-06 | | BR-REV-10 | Hidden slides are not readable or focusable | Kept | FR-TR-09 | | BR-REV-11 | The quote is a `blockquote` with the names as its `figcaption` | Kept, **without** the decorative quotation mark | FR-TR-04 | | BR-LZY-02 | The prerendered HTML holds the text of every shown review | Kept | FR-TR-13 | | BR-TR-01 | The review changes only through the previous and next buttons, the left and right arrow keys while focus is in the control bar, a swipe, or a drag with the mouse. No timer, no pause control, no dots | New | FR-TR-07 | | BR-TR-02 | The counter reads "X / Y" (current of total, from 1). It is visible text that screen readers skip (`aria-hidden`); the live region carries the announcement | New | FR-TR-06, NFR-TR-01 | | BR-TR-03 | The crop of a photo comes from `normalizeImagePosition(testimonial.imagePosition)`; a missing or invalid value gives the centre | New | FR-TR-11 | | BR-TR-04 | Layout switches at `lg` (1024 px). From `lg`: the photo (3:2) on the left overlaps the card on the right. Below `lg`: stacked, with the photo (4:3) at most 640 px wide and centred, and the card overlapping its bottom by 36 px | New (question 1 = A) | FR-TR-01, FR-TR-02 | | BR-TR-05 | The card is at least 400 px high and grows with its text; all slides take the height of the tallest (BR-REV-07). Text is never cut off or shrunk to fit | New (question 2 = A) | FR-TR-01 | | BR-TR-06 | There is no coloured block behind the photo; the card is the surface behind it | New (question 3 = A) | FR-TR-01 | | BR-TR-07 | The card is always `paper.deep`; quote text `ink.soft`; shoot type `ink`; names `accent.deeper`; all at least 4.5:1 on the card | New | FR-TR-03, NFR-TR-01 | | BR-TR-08 | Until the carousel has loaded the placeholder shows the longest review as a slide, and below `lg` also the height of the control bar, so nothing below moves | Changed (no sand-block padding) | FR-TR-13 | | BR-TR-09 | The heading of the section uses the heading style of unit 1 (`SectionHeading`) | Kept from unit 1 | FR-TR-05 | ## Decision flow: what is rendered ```mermaid graph TD Start["Reviews from the content"] Filter["visibleTestimonials"] Count{"How many shown?"} None["Render nothing"] One["One TestimonialSlide, no controls"] Many{"Section near the screen?"} Placeholder["Placeholder: longest slide, others hidden"] Carousel["Carousel with controls and counter"] Start --> Filter Filter --> Count Count -->|"none"| None Count -->|"one"| One Count -->|"two or more"| Many Many -->|"no, or still loading"| Placeholder Many -->|"yes, and loaded"| Carousel classDef step fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; classDef result fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000; class Start,Filter step; class Count,Many decision; class None,One,Placeholder,Carousel result; ``` Text alternative: the reviews are filtered; none renders nothing, one renders a single slide without controls, and two or more render the placeholder until the section is near the screen and the carousel has loaded. ## Decision flow: normalising the crop position ```mermaid graph TD Raw["Raw imagePosition"] Present{"Is it a string?"} Parse{"Two numbers with percent signs, separated by whitespace?"} Range{"Both from 0 to 100?"} Format["Write as X% Y% in shortest form"] Centre["Use 50% 50%"] Raw --> Present Present -->|"no"| Centre Present -->|"yes"| Parse Parse -->|"no"| Centre Parse -->|"yes"| Range Range -->|"no"| Centre Range -->|"yes"| Format classDef step fill:#2196F3,stroke:#0d47a1,stroke-width:1px,color:#000; classDef decision fill:#FF9800,stroke:#e65100,stroke-width:1px,color:#000; classDef result fill:#4CAF50,stroke:#2e7d32,stroke-width:1px,color:#000; class Raw step; class Present,Parse,Range decision; class Format,Centre result; ``` Text alternative: a raw value that is a string of two percentages from 0 to 100 is written in its shortest form; every other value gives the centre.