import React, { useState } from 'react';
import renderer from 'react-test-renderer';
import { render, fireEvent, waitFor, screen } from '@testing-library/react';
import { Button } from '.';
import 'jest-styled-components';
import { CloseBtn } from '../../CloseBtn';

it('renderizar cores de button', () => {
   const tree = renderer
      .create(
         <>
            <Button variant="primary">Primary</Button>
            <Button variant="secondary">Secondary</Button>
            <Button variant="success">Success</Button>
            <Button variant="warning">Warning</Button>
            <Button variant="danger">Danger</Button>
            <Button variant="info">Info</Button>
            <Button variant="light">Light</Button>
            <Button variant="dark">Dark</Button>
            <Button variant="link">Link</Button>
         </>,
      )
      .toJSON();
   expect(tree).toMatchSnapshot();
});

it('renderizar tamanhos de button', () => {
   const tree = renderer
      .create(
         <>
            <Button size="sm">Small</Button>
            <Button size="md">Medium</Button>
            <Button size="lg">Large</Button>
         </>,
      )
      .toJSON();
   expect(tree).toMatchSnapshot();
});

it('testar onClick', (done) => {
   function handleClick(): void {
      done();
   }
   render(<Button onClick={handleClick} data-testid="btn" />);

   fireEvent.click(screen.getByTestId('btn'));
});
