aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/page/page-section.test.tsx
blob: b372ab7ce08592fa89fd7f5a0b09da5b373900f5 (plain)
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
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import { PageSection } from './page-section';

describe('PageSection', () => {
  it('renders its children', () => {
    const body = 'a voluptas iste';

    render(<PageSection>{body}</PageSection>);

    expect(rtlScreen.getByText(body)).toBeInTheDocument();
  });

  it('can use the light variant', () => {
    const body = 'a voluptas iste';

    render(<PageSection variant="light">{body}</PageSection>);

    expect(rtlScreen.getByText(body).parentElement).toHaveClass(
      'section--light'
    );
  });

  it('can use the dark variant', () => {
    const body = 'a voluptas iste';

    render(<PageSection variant="dark">{body}</PageSection>);

    expect(rtlScreen.getByText(body).parentElement).toHaveClass(
      'section--dark'
    );
  });

  it('can have a border at the bottom', () => {
    const body = 'a voluptas iste';

    render(<PageSection hasBorder>{body}</PageSection>);

    expect(rtlScreen.getByText(body).parentElement).toHaveClass(
      'section--bordered'
    );
  });
});