Adds the Lieve woorden section to the homepage
Shows client reviews one at a time with the framed photo, a large quotation mark, the shoot type and the names. Uses Chakra's carousel for paging, looping and swiping with our own controls, so visitors who prefer reduced motion get instant changes, and loads the carousel only when the section comes near the screen so the hero does not wait for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import fc from 'fast-check';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { slideLabel } from './slideLabel';
|
||||
|
||||
// A position within a carousel: 1 to 20 slides, index within range
|
||||
const position = fc
|
||||
.integer({ min: 1, max: 20 })
|
||||
.chain((count) =>
|
||||
fc
|
||||
.integer({ min: 0, max: count - 1 })
|
||||
.map((index) => ({ index, count })),
|
||||
);
|
||||
|
||||
describe('slideLabel', () => {
|
||||
it('counts from one', () => {
|
||||
expect(slideLabel(0, 2)).toBe('Review 1 van 2');
|
||||
expect(slideLabel(1, 2)).toBe('Review 2 van 2');
|
||||
});
|
||||
|
||||
it('gives back its numbers (round-trip)', () => {
|
||||
fc.assert(
|
||||
fc.property(position, ({ index, count }) => {
|
||||
const [, n, m] =
|
||||
/^Review (\d+) van (\d+)$/.exec(slideLabel(index, count)) ??
|
||||
[];
|
||||
expect(Number(n)).toBe(index + 1);
|
||||
expect(Number(m)).toBe(count);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('always reads "Review n van m" with 1 <= n <= m (invariant)', () => {
|
||||
fc.assert(
|
||||
fc.property(position, ({ index, count }) => {
|
||||
const match = /^Review (\d+) van (\d+)$/.exec(
|
||||
slideLabel(index, count),
|
||||
);
|
||||
expect(match).not.toBeNull();
|
||||
const [n, m] = [Number(match?.[1]), Number(match?.[2])];
|
||||
expect(n >= 1 && n <= m).toBe(true);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user