aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-hsts.js
blob: 322ea26f857f6618e20d97a0ce43d23d051aac0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * Original by Scott Helme.
 *
 * Reference: https://scotthelme.co.uk/hsts-cheat-sheet/
 */

Prism.languages.hsts = {
  directive: {
    pattern: /\b(?:includeSubDomains|max-age|preload)(?=[\s;=]|$)/i,
    alias: 'property',
  },
  operator: /=/,
  punctuation: /;/,
};
or: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import NextImage from 'next/image';
import { Heading } from '../../../atoms';
import { ImageWidget } from './image-widget';

describe('ImageWidget', () => {
  it('render the widget heading and an image', () => {
    const heading = 'quam tempore ea';
    const headingLvl = 3;
    const altTxt = 'enim';

    render(
      <ImageWidget
        heading={<Heading level={headingLvl}>{heading}</Heading>}
        img={
          <NextImage
            alt={altTxt}
            height={480}
            src="https://picsum.photos/640/480"
            width={640}
          />
        }
      />
    );

    expect(
      rtlScreen.getByRole('heading', { level: headingLvl })
    ).toHaveTextContent(heading);
    expect(rtlScreen.getByRole('img')).toHaveAccessibleName(altTxt);
  });

  it('can render an image wrapped in a link', () => {
    const heading = 'quam tempore ea';
    const headingLvl = 3;
    const altTxt = 'enim';
    const url = 'https://example.test';

    render(
      <ImageWidget
        heading={<Heading level={headingLvl}>{heading}</Heading>}
        img={
          <NextImage
            alt={altTxt}
            height={480}
            src="https://picsum.photos/640/480"
            width={640}
          />
        }
        url={url}
      />
    );

    expect(rtlScreen.getByRole('link')).toHaveAttribute('href', url);
    expect(rtlScreen.getByRole('img')).toHaveAccessibleName(altTxt);
  });

  it('can render an image with a description', () => {
    const heading = 'quam tempore ea';
    const headingLvl = 3;
    const altTxt = 'enim';
    const desc = 'itaque laudantium ut';

    render(
      <ImageWidget
        description={desc}
        heading={<Heading level={headingLvl}>{heading}</Heading>}
        img={
          <NextImage
            alt={altTxt}
            height={480}
            src="https://picsum.photos/640/480"
            width={640}
          />
        }
      />
    );

    expect(rtlScreen.getByRole('figure')).toHaveAccessibleName(desc);
  });
});