Redesigns the testimonials section

A landscape photo overlaps a card with the shoot type, quote and names. The controls are two arrows with an X / Y counter; the dots are gone and nothing moves by itself. A change slides the whole slide horizontally, also on a swipe. Reviews get an optional imagePosition for the crop, normalised by normalizeImagePosition; slideCounter writes the counter. Both helpers have property tests next to example tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 01:24:14 +01:00
co-authored by Claude Sonnet 5.5
parent 9a2e84e4b2
commit b03b18f58e
14 changed files with 607 additions and 159 deletions
+31 -1
View File
@@ -1,7 +1,12 @@
import fc from 'fast-check';
import { describe, expect, it } from 'vitest';
import testimonials from '../content/testimonials';
import { anyTestimonial, uniqueTestimonials } from '../test/arbitraries';
import type { Testimonial } from '../content/types';
import {
anyTestimonial,
imagePositionAny,
uniqueTestimonials,
} from '../test/arbitraries';
import { isValidTestimonial, visibleTestimonials } from './visibleTestimonials';
const valid = testimonials[0];
@@ -63,6 +68,31 @@ describe('visibleTestimonials', () => {
);
});
it('does not let the crop position decide what is shown (invariant)', () => {
const ids = (items: Testimonial[]) =>
visibleTestimonials(items).map((item) => item.id);
fc.assert(
fc.property(
fc.array(anyTestimonial),
fc.array(imagePositionAny, { minLength: 1, maxLength: 5 }),
(input, positions) => {
const withOther = input.map((item, index) => ({
...item,
imagePosition: positions[index % positions.length] as
string | undefined,
}));
const withNone = input.map((item) => {
const copy = { ...item };
delete copy.imagePosition;
return copy;
});
expect(ids(withOther)).toEqual(ids(input));
expect(ids(withNone)).toEqual(ids(input));
},
),
);
});
it('returns valid, unique reviews unchanged (oracle)', () => {
fc.assert(
fc.property(uniqueTestimonials, (input) => {