aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/atoms/overlay/overlay.test.tsx
blob: fcc694f52ff14cb910e18380f1199a56c6aa185e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { describe, expect, it } from '@jest/globals';
import { render, screen as screenTL } from '@testing-library/react';
import { Overlay } from './overlay';

describe('overlay', () => {
  it('renders its children in front of an overlay', () => {
    const body = 'perferendis voluptatibus ut';

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

    expect(screenTL.getByText(body)).toHaveClass('overlay--visible');
  });

  it('can be hidden', () => {
    const body = 'vel aspernatur mollitia';

    render(<Overlay isVisible={false}>{body}</Overlay>);

    expect(screenTL.getByText(body)).toHaveClass('overlay--hidden');
  });
});