import React from 'react';

import renderWithTheme from '../../../testUtils/renderWithTheme';

import { StyledLink, StyledIconWrapper } from '../StyledLinkButton';

describe('StyleLink', () => {
  it('has enabled style', () => {
    const { container } = renderWithTheme(
      <StyledLink
        themeIntent="primary"
        themeSize="inherit"
        themeDisabled={false}
      />
    );

    expect(container.firstChild).toMatchSnapshot();
  });

  it('has disabled style', () => {
    const { container } = renderWithTheme(
      <StyledLink themeIntent="primary" themeSize="inherit" themeDisabled />
    );

    expect(container.firstChild).toMatchSnapshot();
  });

  it.each`
    size
    ${'small'}
    ${'medium'}
    ${'large'}
    ${'inherit'}
  `('has $size style', ({ size }) => {
    const { container } = renderWithTheme(
      <StyledLink themeIntent="primary" themeSize={size} themeDisabled />
    );

    expect(container.firstChild).toMatchSnapshot();
  });

  it.each`
    intent
    ${'primary'}
    ${'success'}
    ${'danger'}
    ${'warning'}
    ${'error'}
    ${'subdued-text'}
  `('has $intent style', ({ intent }) => {
    const { container } = renderWithTheme(
      <StyledLink
        themeIntent={intent}
        themeSize="inherit"
        themeDisabled={false}
      />
    );

    expect(container.firstChild).toMatchSnapshot();
  });
});

describe('StyledIconWrapper', () => {
  it.each`
    position
    ${'left'}
    ${'right'}
  `('has $position style', ({ position }) => {
    const { container } = renderWithTheme(
      <StyledIconWrapper themePosition={position} />
    );

    expect(container.firstChild).toMatchSnapshot();
  });
});
