summaryrefslogtreecommitdiffstats
path: root/src/components/FormElements/index.tsx
blob: 8ca69b4b7ac0c3da26369cc18c76e751cee23525 (plain)
1
2
3
4
5
6
7
import Field from './Field/Field';
import Form from './Form/Form';
import FormItem from './FormItem/FormItem';
import Label from './Label/Label';
import Toggle from './Toggle/Toggle';

export { Field, Form, FormItem, Label, Toggle };
0; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #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 { render, screen } from '@tests/utils';
import ImageWidget from './image-widget';

const description = 'Ut vitae sit';

const img = {
  alt: 'Et perferendis quaerat',
  height: 480,
  src: 'http://placeimg.com/640/480/nature',
  width: 640,
};

const title = 'Fugiat cumque et';
const titleLevel = 2;

const url = '/another-page';

describe('ImageWidget', () => {
  it('renders an image', () => {
    render(
      <ImageWidget
        expanded={true}
        image={img}
        title={title}
        level={titleLevel}
      />
    );
    expect(screen.getByRole('img', { name: img.alt })).toBeInTheDocument();
  });

  it('renders a link', () => {
    render(
      <ImageWidget
        expanded={true}
        image={img}
        title={title}
        level={titleLevel}
        url={url}
      />
    );
    expect(screen.getByRole('link', { name: img.alt })).toHaveAttribute(
      'href',
      url
    );
  });

  it('renders a description', () => {
    render(
      <ImageWidget
        expanded={true}
        image={img}
        description={description}
        title={title}
        level={titleLevel}
      />
    );
    expect(screen.getByText(description)).toBeInTheDocument();
  });
});