aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/card/card-actions.test.tsx
blob: 94c267732bfb37ee60fbb085f7e685b637ca0098 (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
import { describe, expect, it } from '@jest/globals';
import { render, screen as rtlScreen } from '@testing-library/react';
import { CardActions } from './card-actions';

describe('CardActions', () => {
  it('renders its children', () => {
    const actions = 'animi et omnis';

    render(<CardActions>{actions}</CardActions>);

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

  it('can render its children with start alignment', () => {
    const actions = 'animi et omnis';

    render(<CardActions alignment="start">{actions}</CardActions>);

    expect(rtlScreen.getByText(actions)).toHaveStyle(`--alignment: flex-start`);
  });

  it('can render its children with centered alignment', () => {
    const actions = 'animi et omnis';

    render(<CardActions alignment="center">{actions}</CardActions>);

    expect(rtlScreen.getByText(actions)).toHaveStyle(`--alignment: center`);
  });

  it('can render its children with end alignment', () => {
    const actions = 'animi et omnis';

    render(<CardActions alignment="end">{actions}</CardActions>);

    expect(rtlScreen.getByText(actions)).toHaveStyle(`--alignment: flex-end`);
  });
});