Return

All tests / src/components/BackgroundImage index.tsx

100% Statements 6/6
100% Branches 0/0
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 483x 3x 3x               3x                                                                       6x  
import Image from 'next/image';
import styles from './backgroundImage.module.css';
import backgroundImage from '../../../public/background-image.jpeg';
 
/**
 * @example
 *     <BackgroundImage />;
 *
 * @returns {JSX.Element}
 */
const BackgroundImage = () => {
    return (
        <div className={styles.bgWrap}>
            <Image
                fill
                /**
                 * SDD-L03. This is the LCP candidate on every URL — `Layout` mounts it site-wide,
                 * `fill` + `objectFit: cover` over a fixed full-screen wrapper.
                 *
                 * It carried `loading="eager"` and `quality={100}` and no `priority`, which was the
                 * wrong pair of both. `loading="eager"` only disables lazy-loading; `priority` is what
                 * emits `fetchpriority="high"` and a `<link rel="preload">`. Meanwhile the five 60px
                 * Dock icons *did* carry `priority`, so five decorative preloads outranked the LCP
                 * image. And `quality={100}` delivered 222 KB where the default 75 delivers 19 KB —
                 * measured with the project's own sharp against this source, a factor of 11.7.
                 */
                priority
                data-testid="background-image"
                sizes="100vw"
                placeholder="blur"
                src={backgroundImage}
                /*
                 * SDD-L08: this carried a translated sentence — "This is the background image" — so
                 * a screen reader announced it as the first content of every page on the site,
                 * before any of the real content. The wallpaper conveys nothing; an empty alt is
                 * what marks it decorative and skips it. The catalogue key is deleted with it.
                 */
                alt=""
                style={{
                    objectFit: 'cover',
                }}
            />
        </div>
    );
};
 
export default BackgroundImage;